我在一个界面当中特定的区域实现一个鼠标移动事件FormMouseMove,在这个事件中鼠标到达特定区域是在特定区域显示一个数字,这个已经实现。我现在想要知道当我把鼠标移开这个区域的时候这个事件消失。我写的一些代码如下:
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var
i: Integer;
begin
Button1.Caption := IntToStr(X) + ' ' + IntToStr(Y);
for i := 1 to 48 do
begin
if (X>=QIU[i].X)and(Y>=QIU[i].Y)and(X<=QIU[i].X + 45)and(Y<=QIU[i].Y + 45) then
begin Form1.Canvas.TextOut(QIU[i].X+8,QIU[i].Y+1,'42'); end;
end;
end;
主要是想怎么样解决Form1.Canvas.TextOut(QIU[i].X+8,QIU[i].Y+1,'42');
这个事件。
刚学Delpi才几天,请大侠们帮帮忙。
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var
i: Integer;
begin
Button1.Caption := IntToStr(X) + ' ' + IntToStr(Y);
for i := 1 to 48 do
begin
if (X>=QIU[i].X)and(Y>=QIU[i].Y)and(X<=QIU[i].X + 45)and(Y<=QIU[i].Y + 45) then
begin Form1.Canvas.TextOut(QIU[i].X+8,QIU[i].Y+1,'42'); end;
end;
end;
主要是想怎么样解决Form1.Canvas.TextOut(QIU[i].X+8,QIU[i].Y+1,'42');
这个事件。
刚学Delpi才几天,请大侠们帮帮忙。
Y: Integer);
var
i: Integer;
begin
self.Refresh;
Button1.Caption := IntToStr(X) + ' ' + IntToStr(Y);
for i := 1 to 48 do
begin
if (X>=QIU[i].X)and(Y>=QIU[i].Y)and(X<=QIU[i].X + 45)and(Y<=QIU[i].Y + 45) then
begin Form1.Canvas.TextOut(QIU[i].X+8,QIU[i].Y+1,'42'); end;
end;
end;
DoubleBuffered := True鼠标不在那个区域用背景色刷一次不就行了?
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
if then
else
Form1.Canvas.FillRect();
DoubleBuffered := True