鼠标右击 private { Private declarations } procedure WMNCRButtonDown(var Msg : TWMNCRButtonDown); message WM_NCRBUTTONDOWN;procedure TForm1.WMNCRButtonDown(var Msg : TWMNCRButtonDown); begin if (Msg.HitTest = htCaption) then begin showmessage('caption'); Msg.HitTest := 0; end else if (Msg.HitTest =HTMINBUTTON) then begin showmessage('minbutton'); Msg.HitTest := 0; end else if (Msg.HitTest =HTMAXBUTTON) then begin showmessage('MAXbutton'); Msg.HitTest := 0; end else if (Msg.HitTest = HTCLOSE) then begin showmessage('close'); Msg.HitTest := 0; end else inherited; end;
type TForm1 = class(TForm) public procedure WMEXITSIZEMOVE(var Message: TMessage); message WM_EXITSIZEMOVE; end; var Form1: TForm1;implementationprocedure TForm1.WMEXITSIZEMOVE(var Message: TMessage); begin if self.Top <0 then self.Top := 0; end;
鼠标移动,单击,双击,在sdk里有详细说明
private
{ Private declarations }
procedure WMNCRButtonDown(var Msg : TWMNCRButtonDown); message WM_NCRBUTTONDOWN;procedure TForm1.WMNCRButtonDown(var Msg : TWMNCRButtonDown);
begin
if (Msg.HitTest = htCaption) then
begin
showmessage('caption');
Msg.HitTest := 0;
end
else if (Msg.HitTest =HTMINBUTTON) then
begin
showmessage('minbutton');
Msg.HitTest := 0;
end
else if (Msg.HitTest =HTMAXBUTTON) then
begin
showmessage('MAXbutton');
Msg.HitTest := 0;
end
else if (Msg.HitTest = HTCLOSE) then
begin
showmessage('close');
Msg.HitTest := 0;
end
else
inherited;
end;
TForm1 = class(TForm)
public
procedure WMEXITSIZEMOVE(var Message: TMessage);
message WM_EXITSIZEMOVE;
end;
var
Form1: TForm1;implementationprocedure TForm1.WMEXITSIZEMOVE(var Message: TMessage);
begin
if self.Top <0 then self.Top := 0;
end;