还是用我这种方法,还必须是加个Panel,程序设置其Enable的属性就行了。看代码:
private
procedure Msg(var Msg: TMsg; var Handled: Boolean);
var
MouseX,MouseY:integer;
implementation
procedure TForm1.FormCreate(Sender: TObject);
begin
application.OnMessage:=Msg;
end;
procedure Tform1.Msg(var Msg: TMsg; var Handled: Boolean);
var
Rect1,Rect2,Rect3,Rect4:integer;
begin
Rect1:=Panel1.left;
Rect2:=Panel1.left+Panel1.width;
Rect3:=Panel1.top;
Rect4:=Panel1.left+Panel1.Height;
if msg.message=WM_LBUTTONDOWN then
if //(not Panel1.Enabled)and Panel.Enable 为true时,From接收不到鼠标移动事件,所以没必要这句
(MouseX>Rect1)and(MouseX<Rect2)and
(MouseY>Rect3)and(MouseY<Rect4) then
begin
Application.MessageBox('这里不让你点了!!笨蛋!!','提示',MB_OK);
handled:=true;
end;
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
MouseX:=X;
MouseY:=y;
end;
这个如何??你20分也太少了点呀:)