C# 母版页
我必须设计一个 control_panel 表单。这将有很多选项卡。我应该如何设计这个?我应该为每个选项卡制作不同的新表单还是 C# WinForms 中有母版页的概念?
请给我你的意见。谢谢。
I have to design a control_panel form. This will have many tabs. How should I design this? Should I make different new forms for each tab or is there a concept of Masterpage in C# WinForms?
Please give me your opinions. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
TabControl
,填充了几个不同的TabPages
,以及相应的ImageList
保存每个选项卡的图标:然后您可以像平常一样将所需的控件放置在每个
TabPage
上。设计器对TabControl
具有出色的内置支持,让您只需单击要切换到的选项卡,就像您的应用程序正在运行时一样。这是关于在 C# 中实现选项卡的教程。如果您需要比通过向每个
TabPage
添加单独的控件所提供的更多的可扩展性和封装性,您可以创建自定义UserControl
对应于每个选项卡,然后放置该UserControl
进入TabPage
。我对 MasterPages 不太了解,但是创建一个基础UserControl
,让所有其他UserControls
继承(然后添加它们的独特元素)似乎会这样提供类似的功能。It's easy enough to whip up something like this in WinForms, using a
TabControl
, filled with several differentTabPages
, and a correspondingImageList
to hold the icons for each tab:Then you can just place the controls you want on each
TabPage
as you normally would. The designer has excellent built-in support for theTabControl
, allowing you to simply click on the tab you want to switch to it as you could if your application was running. Here's a tutorial on implementing tabs in C#.If you need more extensibility and encapsulation than provided by adding individual controls to each
TabPage
, you can create a customUserControl
corresponding to each of your tabs, and then place an instance of thatUserControl
into theTabPage
. I don't really know much about MasterPages, but creating a baseUserControl
that all of your otherUserControls
inherit off (and then add their unique elements) of seems like it would provide similar functionality.您在 Windows 窗体中有选项卡控件。
您可以阅读 MSDN 文章来创建选项卡。
You have tab control in windows form.
you can go through MSDN article for creating tabs.