在SplitContainer中的面板上打开新表单 [英] Open new form on a panel in SplitContainer

查看:100
本文介绍了在SplitContainer中的面板上打开新表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

美好的一天!我只是想知道是否可以在SplitContainer的面板内打开新表单?例如,我有一个带有splitcontainer组件的主窗体.容器上的第一个面板包含TreeView,第二个面板是工作区.想法是这样的,当我单击TreeView上的节点时,一个窗体将出现在第二个面板上.这里的想法类似于Visual Studio 2010,当您从解决方案资源管理器中单击表单时,该表单将在应用程序的工作区上弹出.任何意见或建议都是有很大帮助的.顺便说一句,我正在使用Visual Basic2010.

Good day! I''m just wondering if is it possible to open a new form inside a panel on a SplitContainer? For example, I have a main form with splitcontainer component. The 1st Panel on the container contains a TreeView and the 2nd panel is a work area. The idea is this, when I click a node on the TreeView, a form will appear on the 2nd panel. The idea here looks like in Visual Studio 2010, when you click a form from the Solution Explorer, the form will pop-up on the work area of the application. Any comment or suggestion is a big help. By the way, I am using Visual Basic 2010.

推荐答案

要在面板上打开新表单,请使用此代码

to open new form on panel use this code

dim frm as new form
frm.show()
Mypanel.controls.add(frm)



祝您编码愉快!
:)



Happy Coding!
:)


解决方案2

上面的解决方案使我得到正确的答案,我批准了它


Form1 frm = new Form1();
frm.MdiParent = this;
frm.Show();
splitContainer1.Panel1.Controls.Add(frm);
Solution 2

The above Solution Leeds Me the correct answer and I approve it


Form1 frm =new Form1();
frm.MdiParent=this;
frm.Show();
splitContainer1.Panel1.Controls.Add(frm);


这篇关于在SplitContainer中的面板上打开新表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆