L
lich
Unregistered / Unconfirmed
GUEST, unregistred user!
但是,我这里一切正常啊,
要不,发个程序给你看看?
unit xForms;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TCustFrm = class(TForm)
private
FInitPos: TPosition;
{ Private declarations }
protected
procedure CreateParams(var Params: TCreateParams); override;
public
{ Public declarations }
property InitPos: TPosition read FInitPos write FInitPos;
constructor Create(AOwner: TComponent); override;
end;
var
CustFrm: TCustFrm;
implementation
{ TAboutFrm }
constructor TCustFrm.Create(AOwner: TComponent);
begin
// 不能用这个类直接创建窗口,只能使用其基类
if not ClassParent.InheritsFrom(TCustFrm) then
begin
CreateNew(AOwner);
end
else
begin
inherited;
FInitPos := Position;
end;
end;
procedure TCustFrm.CreateParams(var Params: TCreateParams);
const
Bds: array[TFormBorderStyle] of Integer = (
0, 0, 0, WS_BORDER or WS_CAPTION,
WS_BORDER or WS_CAPTION, WS_BORDER or WS_CAPTION);
Mins: array[Boolean] of Integer = (0, WS_MINIMIZEBOX);
Maxs: array[Boolean] of Integer = (0, WS_MAXIMIZEBOX);
Mnus: array[Boolean] of Integer = (0, WS_SYSMENU);
begin
inherited;
if Params.Style and WS_CHILD <> 0 then
begin
Params.Style := WS_CHILD or Bds[BorderStyle] or
Mnus[biSystemMenu in BorderIcons] or
Mins[biMinimize in BorderIcons] or
Maxs[biMaximize in BorderIcons];
end;
end;
end.
要不,发个程序给你看看?
unit xForms;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TCustFrm = class(TForm)
private
FInitPos: TPosition;
{ Private declarations }
protected
procedure CreateParams(var Params: TCreateParams); override;
public
{ Public declarations }
property InitPos: TPosition read FInitPos write FInitPos;
constructor Create(AOwner: TComponent); override;
end;
var
CustFrm: TCustFrm;
implementation
{ TAboutFrm }
constructor TCustFrm.Create(AOwner: TComponent);
begin
// 不能用这个类直接创建窗口,只能使用其基类
if not ClassParent.InheritsFrom(TCustFrm) then
begin
CreateNew(AOwner);
end
else
begin
inherited;
FInitPos := Position;
end;
end;
procedure TCustFrm.CreateParams(var Params: TCreateParams);
const
Bds: array[TFormBorderStyle] of Integer = (
0, 0, 0, WS_BORDER or WS_CAPTION,
WS_BORDER or WS_CAPTION, WS_BORDER or WS_CAPTION);
Mins: array[Boolean] of Integer = (0, WS_MINIMIZEBOX);
Maxs: array[Boolean] of Integer = (0, WS_MAXIMIZEBOX);
Mnus: array[Boolean] of Integer = (0, WS_SYSMENU);
begin
inherited;
if Params.Style and WS_CHILD <> 0 then
begin
Params.Style := WS_CHILD or Bds[BorderStyle] or
Mnus[biSystemMenu in BorderIcons] or
Mins[biMinimize in BorderIcons] or
Maxs[biMaximize in BorderIcons];
end;
end;
end.