要想在窗体最小化的时候 发生事件,因该怎么办(0分)

F

fossil

Unregistered / Unconfirmed
GUEST, unregistred user!
在窗体最小化是什么事件 可以添加自己的程序
 
http://www.delphibbs.com/delphibbs/dispq.asp?lid=914596
http://www.delphibbs.com/delphibbs/dispq.asp?lid=852333
 
:)
--------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
procedure FormResize(Sender: TObject);
procedure FormClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormResize(Sender: TObject);
begin
if WindowState=wsMinimized then
ShowMessage('ok');
end;

procedure TForm1.FormClick(Sender: TObject);
begin
WindowState:=wsMinimized
end;

end.
--------------------
WindowState:=wsMinimized 时触发FormResize~
 
窗体最小化
 
timer事件:
begin
if form1.WindowState:=wsMinimized then
begin
//你要在最小化时输入的代码!
end;
[:)]
end;
 
D影子D ,你的不管用
 
Procedure WMSysCommand(Var msg : TMessage);
Message WM_SYSCOMMAND;
procedure TForm1.WMSysCommand(var msg: TMessage);
begin
if msg.WParam=SC_MINIMIZE then
begin
showmessage('a');//your things;
inherited;
end
else
Inherited;
end;
 
我是想做个托盘,在最小化后变成托盘,可是总是出问题
procedure TForm1.AddIco;
var
nid: TNotifyIconData;
begin
nid.cbSize := sizeof(nid);
nid.Wnd := Handle;
nid.uID := 0;
nid.hIcon := Application.Icon.Handle;
nid.szTip := 'test';
nid.uCallbackMessage := MY_MESSAGE;
nid.uFlags := NIF_ICON or NIF_TIP or NIF_MESSAGE;
if not Shell_NotifyIcon(NIM_ADD, @nid) then
begin
ShowMessage('error');
Application.Terminate;
end;
end;
procedure TForm1.WMSysCommand(var msg: TMessage);
begin
if msg.WParam=SC_MINIMIZE then
begin
AddIco;
Form1.Hide;
inherited;
end else
Inherited;
end;
 
kingdeezj: 为什么我把
procedure TForm1.WMSysCommand(var msg: TMessage);
begin
if msg.WParam=SC_MINIMIZE then
begin
AddIco;
Form1.Hide;
inherited;//把它去掉 ,就回没有问题了那,窗体最小化时候,就只会出现托盘
end else
Inherited;
end;
 
procedure TForm1.FormCanResize(Sender: TObject;
var NewWidth,
NewHeight: Integer;
var Resize: Boolean);
begin
if form1.WindowState =wsMinimized then
form1.close--->发生事件
end;

procedure TForm1.FormClick(Sender: TObject);
begin
WindowState:=wsMinimized
end;
 
接受答案了.
 
谢谢,你送我一个鸡蛋。baby
 

Similar threads

D
回复
0
查看
798
DelphiTeacher的专栏
D
D
回复
0
查看
751
DelphiTeacher的专栏
D
D
回复
0
查看
738
DelphiTeacher的专栏
D
顶部