C# 使用表单控件在运行时添加选项卡
我想到了这个想法,您可以在表单上有一个选项卡控件,但不是在运行时之前定义每个选项卡控件,而是继承或使用另一个表单的控件。
基本上,选项卡控件位于主窗体上,在运行时之前其上没有选项卡。 当运行时出现时,我想创建选项卡,但每个选项卡上的控件将来自单独的已创建的表单。
每个表单都是在运行之前创建的单独选项卡。
这可能吗? 是这样,怎么样?
提前致谢
编辑 我用的是3.5
I have thought of this idea where you could have a tab control on a form, but instead of defining each tabs controls before runtime, inherit or use another form's controls.
Basically a tab control is in place on the main form that has no tabs on it before runtime. When runtime comes along I want to create tabs, but the controls that would be on each tab would be from seperate already created forms.
Each form would be a seperate tab that had been created prior to runtime.
Is this possible? Is so, how?
Thanks in advance
EDIT
I'm using 3.5
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
首先创建一个用户控件并像常规表单一样设计它,然后将其添加到您的 TabControl.TabPages
first create a User Control and design it as you would a regular form, then add it to your TabControl.TabPages
如果您要做的只是将控件从一个窗体上的 TabControl 复制到另一个窗体上的 TabControl:
If all you'll be doing is copying controls from a TabControl on one form to a TabControl on another form:
对的,这是可能的。 您必须添加控件到 TabPage 上,然后添加 TabPage到 TabControl.TabPages
Yes, it is possible. You have to add the controls onto the TabPage, then add the TabPage to the TabControl.TabPages