Y
yczjs
Unregistered / Unconfirmed
GUEST, unregistred user!
前几天看富翁笔记中有人收藏的,但不会调用,请指点,谢谢!
procedure ShowFormAsChild(var AForm: TForm; AFormClass: TClass;
AParent: TWinControl; AlignClient:Boolean = True);
var
acW,acH:Integer;
i:Integer;
begin
if not Assigned(AForm) then
Application.CreateForm(TComponentClass(AFormClass), AForm);
for i := 0 to AParent.ControlCount -1 do
begin
if AParent.Controls is TForm then
TForm(AParent.Controls).Hide;
end;
AForm.Parent := AParent;
AForm.Left := 0;
AForm.Top := 0;
if AlignClient then
AForm.Align := alClient;
acW := AForm.ClientWidth;
acH := AForm.ClientHeight;
AForm.BorderStyle := bsNone;
AForm.Width := acW;
AForm.Height := acH;
AForm.BringToFront;
AForm.Show;
end;
procedure ShowFormAsChild(var AForm: TForm; AFormClass: TClass;
AParent: TWinControl; AlignClient:Boolean = True);
var
acW,acH:Integer;
i:Integer;
begin
if not Assigned(AForm) then
Application.CreateForm(TComponentClass(AFormClass), AForm);
for i := 0 to AParent.ControlCount -1 do
begin
if AParent.Controls is TForm then
TForm(AParent.Controls).Hide;
end;
AForm.Parent := AParent;
AForm.Left := 0;
AForm.Top := 0;
if AlignClient then
AForm.Align := alClient;
acW := AForm.ClientWidth;
acH := AForm.ClientHeight;
AForm.BorderStyle := bsNone;
AForm.Width := acW;
AForm.Height := acH;
AForm.BringToFront;
AForm.Show;
end;