开发者

How to Embed a Form within another Form in c#?

In an internet webpage , there is a constant menu usually placed on the top or left of a page from which user can navigate (They call it Iframes) ..

I would like to know if it is possible to do something like that using WinForm ap开发者_如何学JAVAplications or WPF applications in c# .

At present I am simply inheriting forms from a base class . and each time the user needs to navigate , I have no option but to open up a new form with the same Peristent menu ...

Any suggestions here ?


I managed to use usercontrol to embed a form into another ..

Form1 has a userControl , Form2 embedded inside the user control .

things to note was .. the embedded forms toplevel property should be set to false the embedded forms FormBorderStyle should be set to none

userControl1.Controls.Clear();
Form2 f = new Form2();
f.Toplevel=flase;
f.Show();
f.TopLevel = false;
userControl1.Controls.Add(f);


You could use an MDI-container in WinForms. see here and here for more information.


You mean like an MDI application (http://www.codeproject.com/KB/cs/myBestMDI.aspx) or just using a SplitContainer on the form? Really there are many options. WPF has ElementHost I think. Did you do any research yet? What did you find?

You could also take the toolbox approach. Have a parent program start the menu form and then other forms can use it... or it can launch from it... what ever your use case is.


Well, there should be a frame component in WPF which will give you such an option. Then you would use a "view" concept to open the WPF Pages you direct the user to.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜