C# 母版页

发布于 2024-10-04 00:39:44 字数 112 浏览 4 评论 0原文

我必须设计一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

辞慾 2024-10-11 00:39:44

使用 TabControl,填充了几个不同的TabPages,以及相应的 ImageList 保存每个选项卡的图标:

Sample form with tabs

然后您可以像平常一样将所需的控件放置在每个 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 different TabPages, and a corresponding ImageList to hold the icons for each tab:

Sample form with tabs

Then you can just place the controls you want on each TabPage as you normally would. The designer has excellent built-in support for the TabControl, 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 custom UserControl corresponding to each of your tabs, and then place an instance of that UserControl into the TabPage. I don't really know much about MasterPages, but creating a base UserControl that all of your other UserControls inherit off (and then add their unique elements) of seems like it would provide similar functionality.

放赐 2024-10-11 00:39:44

您在 Windows 窗体中有选项卡控件。
您可以阅读 MSDN 文章来创建选项卡。

You have tab control in windows form.
you can go through MSDN article for creating tabs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文