如何在vb.net的同一面板中添加所有Windows窗体? [英] How to add all windows form in the same panel in vb.net?

查看:322
本文介绍了如何在vb.net的同一面板中添加所有Windows窗体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有访客
我在vb.net中的子表单有问题.具有子表单的是不同的Access.
我有3种形式(1是主要形式,2是项目形式,3项目清单)
这是我的过程:
1.项目窗体在主窗体的panel1内
2.当我单击表格2(项目)上的按钮时,可以打开表格3(项目列表)
3.在主窗体的panel1内也显示项目列表时

如何在主窗体的panel1内创建项目列表?

最好的问候,
TONY

hi all visitors
i have problem with sub form in vb.net. it is different Access that have sub form.
i have 3 forms( 1 is main form,2 is item form,3 item list)
This is my process:
1. item form is inside panel1 of main form
2. form 3(item list) can open when i click buttom on form 2( Item)
3. when display item list also inside panel1 of main form too

how can i make item list inside panel1 of main form?

Best Regards,
TONY

推荐答案

您不能将一种形式放入另一种形式. 表单之间没有功能上的父子关系.

形式上,FormControl,因此Control.Parent可以用于Forms,但是尝试使一种形式成为另一种形式的父项会引发异常.您可以使用P/Invoked非托管Windows API SetParent来解决问题,但是……不要这样做.防止将表单放入表单是一种很好的防呆措施,请不要滥用此.NET UI库.

相反,只做一种形式.用Control.Parents.Add可以将不同的表单重新制作成面板.一个很好的替代方法是使用TabControl.在这种情况下,您的表单将是TabPages.它易于实现,并且外观和功能非常好.

祝你好运,
—SA
You cannot put one form insider another. There is no functional parent-child relationship between forms.

Formally, a Form is Control, so Control.Parent could be used for Forms, but an attempt to make one form a parent of another one throws an exception. You can do a dirty work-around by using P/Invoked unmanaged Windows API SetParent, but… don''t do it. The preventions of putting a form into a form is a good fool-proof measure, don''t abuse this .NET UI library.

Instead, make just one form. What were different forms re-work into panels, use Control.Parents.Add. A very good alternative is using TabControl; in this case what were your form will be the TabPages. It''s easy to implement and looks and function in a very nice ways.

Good luck,
—SA


这篇关于如何在vb.net的同一面板中添加所有Windows窗体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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