[英]C# Tab Control - Inherit from TabPage?
Basically, I am creating a Windows Form with a Tab Control on it, and I want to have multiple types of tab pages for the different types of objects I will be editing the properties of. 基本上,我正在创建一个带有选项卡控件的Windows窗体,并且我想为要编辑其属性的不同类型的对象提供多种类型的选项卡页。 Basically like interface in Visual Studio, where you can have multiple tab pages of code, then multiple tabs of resource files, etc. 基本上类似于Visual Studio中的界面,您可以在其中具有多个标签页的代码,然后具有资源文件的多个标签等。
To do this, I figure that I will need to: 为此,我认为我需要:
However, this means that I cannot design the tab pages in Visual Studio (I will need to code the layout by hand). 但是,这意味着我无法在Visual Studio中设计选项卡页(我将需要手工编写布局代码)。
Am I going about this the correct way? 我要用正确的方法吗? Or is there a different way to approach this problem? 还是有解决此问题的其他方法?
Have you considered creating a Custom Control for each type of page that you want to display? 您是否考虑过为要显示的每种页面类型创建自定义控件? Rather than having different types of tabs, you can then use Visual Studio to design the layout of each custom control (along with any code that is per-tab), and when a new tab is created, make its sole child control an instance of the relevant type of custom control. 然后,您可以使用Visual Studio设计每个自定义控件的布局(以及每个选项卡的所有代码),而不是使用不同类型的选项卡,并且在创建新选项卡时,使其唯一的子控件成为相关类型的自定义控件。
Advantages : 优点 :
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.