300分请问如何使dll中的窗体嵌在panel中?(100分)

  • 主题发起人 主题发起人 arriving
  • 开始时间 开始时间
A

arriving

Unregistered / Unconfirmed
GUEST, unregistred user!
也就是说panel能成为dll中的父类,源码如下:<br>dll的输出函数是:<br>&nbsp; &nbsp;Procedure ShowConfigure (appHandle:HWND;Owner:TWinControl);//owner是panel<br>其实现:<br>&nbsp; application.Handle:=appHandle;<br>&nbsp; form3:=tform3.Create(application,owner);//form3就是dll中的窗体<br><br>form3如下:<br>&nbsp; Tform3 = class(TForm)<br>&nbsp; &nbsp; Panel1: TPanel;<br>&nbsp; private<br>&nbsp; &nbsp; FParent:TWinControl;<br>&nbsp; protected<br>&nbsp; &nbsp; procedure CreateParams(var Params : TCreateParams);override;<br>&nbsp; &nbsp; procedure Loaded;override;<br>&nbsp; public<br>&nbsp; &nbsp; constructor Create(AOwner : TComponent; AParent : TWinControl);overload;<br>&nbsp; end;<br><br>var<br>&nbsp; form3: Tform3;<br><br>implementation<br><br>{$R *.dfm}<br>procedure tform3.CreateParams(var params:TCreateParams);<br>begin<br>&nbsp; inherited Createparams(params);<br>&nbsp; params.Style:=WS_CHILD or WS_CLIPSIBLINGS;<br>end;<br><br>procedure tform3.Loaded;<br>begin<br>&nbsp; align:=alClient;<br>&nbsp; BorderStyle:=bsNone;<br>&nbsp; BorderIcons:=[];<br>&nbsp; Position:=poDefault;<br>&nbsp; Parent:= FParent;<br>end;<br><br>constructor tform3.Create(AOwner : TComponent; AParent : TWinControl);<br>begin<br>&nbsp; FParent:=AParent;<br>&nbsp; inherited Create(AOwner);<br>end; &nbsp;<br><br>这段程序中有什么错误么?
 
你运行一下不就知道有什么错误了么[:D]
 
运行了没有错误,但是就是没有窗体显示出来
 
试试这样修改:<br><br>tform3.Create(AOwner : TComponent; AParent : TWinControl);<br>begin<br>&nbsp; inherited Create(AOwner);<br>&nbsp; FParent:=AParent;<br>&nbsp; ManualDock(AParent, nil, alClient);<br>end; &nbsp;<br>主界面调用时:<br>&nbsp; Panel1.DockSite := true;<br>&nbsp; ShowConfigure (Handle,Panel1); <br>&nbsp; Panel1.DockSite := False;<br>
 
你调用窗体的Show或Visible:=True了吗?<br>
 
pengjing:用你的方法只是能显示出来,而不能作为panel的嵌入控件。<br>我已经自己解决了这个问题了。谢谢各位!
 
后退
顶部