unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure Appmessage(var msg:Tmsg;var handled:boolean);
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure Tform1.Appmessage (var msg:Tmsg;var handled:boolean);
begin
if Msg.message=WM_LButtonDown then
begin
if DefWindowProc(Handle,WM_NCHitTest,0,GetMessagePos)=HTClient then
begin
SendMessage(Handle,WM_NCLButtonDown,HTCaption,GetMessagePos);
Handled:=true;
end;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnMessage:=AppMessage;
end;
end.
另外还别忘了把 BoardStyle 属性设置为 bsSingle.