Procedure WMSysCommand(Var message : TMessage) ; Message WM_SYSCOMMAND ;Procedure TMainForm.WMSysCommand(Var Message : TMessage) ; begin Case message of SC_MINIMIZE : //最小化 SC_MAXMIZE : //最大化 end ; end ;
多谢 hhzqf1980(hh),我试一下。
hhzqf1980(hh),我编译时怎么报错:ordinal type required ;undeclared identifier:sc_maxmize,这是什么原因啊,难道需要在unit中加入什么类吗?还有就是sc_maxmize后加入什么内容呢,我定位form的left、top、width、height值可以吗?希望再次看到你的回复。
首先 public const int SC_MAXMIZE = 61488;
unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs;type TForm1 = class(TForm) private { Private declarations } public procedure aa(var message:twmnclbuttondblclk); message wm_nclbuttondblclk; { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure tform1.aa(var message:twmnclbuttondblclk); begin if message.HitTest=htcaption then begin message.HitTest:=htclient; end; end;end.
begin
Case message of
SC_MINIMIZE : //最小化
SC_MAXMIZE : //最大化 end ;
end ;
public const int SC_MAXMIZE = 61488;
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;type
TForm1 = class(TForm)
private
{ Private declarations }
public
procedure aa(var message:twmnclbuttondblclk); message wm_nclbuttondblclk;
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure tform1.aa(var message:twmnclbuttondblclk);
begin
if message.HitTest=htcaption then
begin
message.HitTest:=htclient;
end;
end;end.