procedure WMGetMinMaxInfo(var MSG: Tmessage); message WM_GetMinMaxInfo; procedure TForm1.WMGetMinMaxInfo(var MSG: Tmessage); begin inherited; with PMinMaxInfo(MSG.lparam)^ do begin with ptMinTrackSize do begin X := Form1.Width; Y := Form1.Height; end; with ptMaxTrackSize do begin X := Form1.Width; Y := Form1.Height; end; end; end;
procedure TForm1.WMGetMinMaxInfo(var MSG: Tmessage);
begin
inherited;
with PMinMaxInfo(MSG.lparam)^ do
begin
with ptMinTrackSize do
begin
X := Form1.Width;
Y := Form1.Height;
end;
with ptMaxTrackSize do
begin
X := Form1.Width;
Y := Form1.Height;
end;
end;
end;
有问题请发信息到我的E-mail:[email protected]
第二个方法是:当位置变时在setwindowpos();
不想移动就这样做unit Unit1;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;type
TForm1 = class(TForm)
private
{ Private declarations }
procedure wmsys(var m:tmessage); message wm_syscommand;
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}{ TForm1 }procedure TForm1.wmsys(var m: tmessage);
begin
if (m.WParam=sc_move+2) or (m.WParam=sc_move)// or (m.WParam=sc_size)
then m.WParam:=0
else inherited;
end;end.