如何做到子窗体最小化后和父窗体一样,在任务栏上也有一个最小化后的任务条(100分)

  • 主题发起人 主题发起人 xinghuang
  • 开始时间 开始时间
X

xinghuang

Unregistered / Unconfirmed
GUEST, unregistred user!
大家帮个忙,谢谢
 
都没人了吗
 
子窗体中这样写:
unit Unit2;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

type
TForm2 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure CreateParams(var Params: TCreateParams); override;
end;

var
Form2: TForm2;

implementation

{$R *.DFM}

procedure TForm2.CreateParams(var Params: TCreateParams);
begin
inherited;
Params.WndParent:=0;
end;

procedure TForm2.FormCreate(Sender: TObject);
begin
//SetWindowLong(Handle,GWL_EXSTYLE,WS_EX_TOOLWINDOW);
SetWindowPos(handle,HWND_TopMost,0,0,0,0,
SWP_NOMOVE or SWP_NOSIZE or SWP_NOACTIVATE);
end;

end.
 
form1的:

procedure TForm1.Button1Click(Sender: TObject);
begin
form2.Show
end;

///////////////////////////////////////////////
form2的:

type
TForm2 = class(TForm)
private
procedure CreateParams(var Params: TCreateParams); override;
{ Private declarations }
public
{ Public declarations }
end;

var
Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.CreateParams(var Params: TCreateParams);
begin
inherited;
Params.WndParent := 0;
end;
end.
 
按钮按动慢了一点点 [:)]
 
谢谢,搞定了
 
后退
顶部