用鼠标右键单击窗口的标题栏,可以自动把窗体卷起,再单击展开unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
lbl1: TLabel;
procedure FormClick(Sender: TObject);
private
fOldClientHeight: Integer;
procedure WMNCRButtonDown(var Msg: TWMNCRButtonDown) ; message WM_NCRBUTTONDOWN;
public
end;var
Form1: TForm1;implementation
{$R *.dfm}procedure TForm1.WMNCRButtonDown(var Msg: TWMNCRButtonDown) ;
var
h : integer;
begin
if (Msg.HitTest = HTCAPTION) then
begin
if (ClientHeight = 0) then
begin
for h := 0 to fOldClientHeight do ClientHeight := h;
Application.ProcessMessages;
end
else
begin
fOldClientHeight := ClientHeight;
for h := fOldClientHeight downto 0 do ClientHeight := h;
Application.ProcessMessages;
end;
end;
end;
procedure TForm1.FormClick(Sender: TObject);
begin
Close;
end;end.
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
lbl1: TLabel;
procedure FormClick(Sender: TObject);
private
fOldClientHeight: Integer;
procedure WMNCRButtonDown(var Msg: TWMNCRButtonDown) ; message WM_NCRBUTTONDOWN;
public
end;var
Form1: TForm1;implementation
{$R *.dfm}procedure TForm1.WMNCRButtonDown(var Msg: TWMNCRButtonDown) ;
var
h : integer;
begin
if (Msg.HitTest = HTCAPTION) then
begin
if (ClientHeight = 0) then
begin
for h := 0 to fOldClientHeight do ClientHeight := h;
Application.ProcessMessages;
end
else
begin
fOldClientHeight := ClientHeight;
for h := fOldClientHeight downto 0 do ClientHeight := h;
Application.ProcessMessages;
end;
end;
end;
procedure TForm1.FormClick(Sender: TObject);
begin
Close;
end;end.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货