关于多个窗体套用的问题!!!
我现在想把一个大的窗体分为三个部分,而每个部分可以显示不同的三个其它窗体,请问这个应该怎么实现呢??? 问题点数:0、回复次数:4Top
1 楼redher(红孩儿)回复于 2005-04-05 12:44:02 得分 0
用standerd众的TForms组件Top
2 楼heluqing(鉴之小河〖劳累求充实〗)(vcl .net)回复于 2005-04-05 12:56:30 得分 0
frame怎么样?Top
3 楼Love_birds(蝎子王)回复于 2005-04-06 13:16:51 得分 0
用FRAME是一种办法!
另外一种办法就是在主FORM中动态创建三个子FORMN这三个子FORMN的parent设置为FORM1就行。
至于位置,就看你自己的了!Top
4 楼wzwcn(牛)回复于 2005-04-07 10:04:48 得分 0
子窗体单元代码:
unit ChildFormUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TChildForm = class(TForm)
procedure formclose(sender:TObject;var Action:TcloseAction);
private
{ Private declarations }
FTempparent:twincontrol;
protected
procedure createparams(var params:Tcreateparams);override;
procedure loaded;override;
public
{ Public declarations }
constructor create(AOwner:Tcomponent;AParent:Twincontrol);reintroduce;overload;
end;
var
ChildForm: TChildForm;
implementation
{$R *.dfm}
procedure TchildForm.createparams(var params:Tcreateparams);
begin
inherited createparams(params);
params.Style:=params.Style or WS_CHILD;
end;
constructor TchildForm.create(AOwner:Tcomponent;AParent:Twincontrol);
begin
Ftempparent:=aparent;
inherited create(AOwner);
end;
procedure tChildForm.loaded;
begin
inherited;
align:=alclient;
borderstyle:=bsnone;
bordericons:=[];
parent:=FTempparent;
position:=poDefault;
end;
procedure tchildform.formclose(sender:TObject;var Action:TcloseAction);
begin
Action:=cafree;
end;
end.
把它引入你的工程,继承这个窗体建三个子窗体。在主窗体你要显示子窗体的地方地panel,调整好大小。用以下方法在panel中显示子窗体。。。
if not assigned(chfrm) then
begin
chfrm:=Tchfrm.create(application,panel3);
chfrm.Show;
end;Top




