1177
社区成员
type
TForm2 = class(TForm)
private
{ Private declarations }
procedure CreateParams(var params: TCreateParams); override;
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.CreateParams(var params: TCreateParams);
begin
inherited;
with Params do
begin
ExStyle :=ExStyle or WS_EX_TOPMOST;
end;
//Form2的父窗口是desktop
Params.WndParent := GetDesktopWindow();
end;
[/quote]
这个在什么时候调用?[/quote]
这个是属于窗体自己生命周期里维护的,不需要显式调用。delphi的帮助里是这么说
The CreateWnd method calls CreateParams to initialize the parameters it passes to CreateWindowHandle. Override CreateParams to customize the way a control creates its Windows representation. When overriding CreateParams, always call the inherited method first to set the default values, then make any desired adjustments.
type
TForm2 = class(TForm)
private
{ Private declarations }
procedure CreateParams(var params: TCreateParams); override;
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.CreateParams(var params: TCreateParams);
begin
inherited;
with Params do
begin
ExStyle :=ExStyle or WS_EX_TOPMOST;
end;
//Form2的父窗口是desktop
Params.WndParent := GetDesktopWindow();
end;
[/quote]
这个在什么时候调用?
type
TForm2 = class(TForm)
private
{ Private declarations }
procedure CreateParams(var params: TCreateParams); override;
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.CreateParams(var params: TCreateParams);
begin
inherited;
with Params do
begin
ExStyle :=ExStyle or WS_EX_TOPMOST;
end;
//Form2的父窗口是desktop
Params.WndParent := GetDesktopWindow();
end;