步聚如下:
1、在窗体上放一个pageControl,放设置其align为client;
2、AForm := AClass.Create(TFrame); //建立新页面;
3、AForm.show;
其具体示范代码如下:
创建:
AFrame1 := TProjAccept(CreatePageForm(TProjAccept));
调用函数:
function TMDIChild.CreatePageForm(AClass: TFrameClass): TFrame;
var
AForm: Tframe;
i: integer;
begin
Result := nil;
//判断窗口是否已经创建
for i:=0 to FormNumber-1 do
if (FWindows.FormName=AClass.ClassName)
and (FWindows.FormPointer<>nil) then
begin
// SendMessage(TfRame(FWindows.FormPointer).Handle,UM_FrameBringFront,0,0);
TfRame(FWindows.FormPointer).BringToFront;
Result := FWindows.FormPointer;
Exit;
end;
//Create, insert, registe
AForm := AClass.Create(FAppPara.Owner); //建立新页面;
if Assigned(AForm) then
begin
AForm.Parent :=FAppPara.Owner;
AForm.Left := (FAppPara.Owner.Width - AForm.Width) div 2;
AForm.Top := (FAppPara.Owner.Height - AForm.Height) div 2;
AForm.Align:=alClient;
//AForm.left:=30;
//AForm.top:=80;
//sendMessage(AForm.Handle,UM_FrameShow,0,0);
for i:=0 to FormNumber-1 do
if FWindows.FormName=AForm.ClassName then
begin
FWindows.FormPointer := AForm;
break;
end;
AForm.Show;
end;
Result := AForm;
end;
如果还有什么问题,请联系:zhong@sitech.com.cn