子窗体显示问题(100分)

  • 主题发起人 jiangxidna
  • 开始时间
J

jiangxidna

Unregistered / Unconfirmed
GUEST, unregistred user!
我现在做的是一个gis系统,主窗体上我放了一个panel,然后让地图在panel上显示。功能窗体简称a是子窗体显示。现在我再做了一个窗体,简称b,b窗体不是子窗体显示,在b窗体里我用了一个button来调用a窗体,a窗体是子窗体显示,我调出来a窗体后,b窗体我没有让他在调出a窗体后就退出,因为我不想这么做,我还有用。然后在调出a窗体后,我怎么弄也没法将焦点落到该窗体上,除非我把b窗体关闭,焦点才能落到a窗体上。不知道诸位仁兄有什么高招,帮小弟解决下!功能窗体显示调用showForm,代码如下:<br>procedure TfrmIceCheckForm.<br>ShowForm(FormClass: TFormClass);<br>var<br>&nbsp; I: Integer;<br>&nbsp; Child: TForm;<br>begin<br><br>&nbsp; for I := 0 to Screen.FormCount - 1 do<br>&nbsp; &nbsp; if Screen.Forms.ClassType = FormClass then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; Child := Screen.Forms;<br>&nbsp; &nbsp; &nbsp; if Child.WindowState = wsMinimized then<br>&nbsp; &nbsp; &nbsp; &nbsp; ShowWindow(Child.Handle, SW_SHOWNORMAL)<br>&nbsp; &nbsp; &nbsp; else<br>&nbsp; &nbsp; &nbsp; &nbsp; ShowWindow(Child.handle,SW_SHOWNA);<br>&nbsp; &nbsp; &nbsp; if (not Child.Visible) then Child.Visible := True;<br><br>&nbsp; &nbsp; &nbsp; //Child.parent:=pnlmap;<br>&nbsp; &nbsp; &nbsp; // windows.SetParent(Child.Handle,pnlmap.Handle) ;<br><br>&nbsp; &nbsp; &nbsp; &nbsp; Child.BringToFront;<br>&nbsp; &nbsp; &nbsp; &nbsp; Child.Setfocus;<br>&nbsp; &nbsp; &nbsp; &nbsp; Exit;<br>&nbsp; &nbsp; end;<br>&nbsp; Child := TForm(FormClass.NewInstance);<br>&nbsp;// Child.Create(Self);<br>&nbsp; &nbsp;Child.Create(pnlmap);<br>&nbsp; &nbsp;windows.SetParent(Child.Handle,pnlmap.Handle) ;<br>&nbsp; &nbsp;Child.WindowState:=wsMaximized;<br>&nbsp; if Child.FormStyle&lt;&gt;fsMDIChild then<br>&nbsp; &nbsp; Child.FormStyle:=fsMDIChild;<br>end;<br>如果有说的不清楚的,请告诉我,我再解释
 
if Child.FormStyle&lt;&gt;fsMDIChild then<br>&nbsp; &nbsp; Child.FormStyle:=fsMDIChild;<br>不要动态设置mdi风格(),另外mdi风格只有一个焦点,如果你想让他获得焦点,直接使用fsNormal风格<br>delphi帮助: <br>Note: It is not advisable to change FormStyle at runtime.
 
我现在整体风格已经做成子窗体显示情况了,改成normal也就是逼不得以了
 
也用子窗体显示试试
 
接受答案了.
 

Similar threads

D
回复
0
查看
1K
DelphiTeacher的专栏
D
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
519
import
I
顶部