代码很简单
type
TfrmMain = class(TForm)
.
.
protected
procedure WndProc(var Message: TMessage);override;
end;
implementation
{$R *.dfm}
procedure TfrmMain.WndProc(var Message: TMessage);
var
pos:PWINDOWPOS;
begin
case Message.Msg of
WM_WINDOWPOSCHANGING:begin
pos := PWINDOWPOS(Message.LParam);
if(pos^.y<20) then
pos^.y := 0;
if(pos^.x>1004-Width)then
pos^.x := 1024-Width-3;
end;
end;
inherited WndProc(Message);
end;
type
TfrmMain = class(TForm)
.
.
protected
procedure WndProc(var Message: TMessage);override;
end;
implementation
{$R *.dfm}
procedure TfrmMain.WndProc(var Message: TMessage);
var
pos:PWINDOWPOS;
begin
case Message.Msg of
WM_WINDOWPOSCHANGING:begin
pos := PWINDOWPOS(Message.LParam);
if(pos^.y<20) then
pos^.y := 0;
if(pos^.x>1004-Width)then
pos^.x := 1024-Width-3;
end;
end;
inherited WndProc(Message);
end;