当前位置:编程学习 > Delphi >>

delphi窗体卷起来的小例子

用鼠标右键单击窗口的标题栏,可以自动把窗体卷起,再单击可以展开
谁有这样的程序代码可以写出来么
答案:
Delphi(Pascal) code
unit Unit1;

inte易做图ce

uses
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.

上一个:delphi对数据的添加删除修改查询
下一个:请教关于Delphi进度条的使用:

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,