WindowsForms 的不同布局模式

发布于 2024-07-14 20:35:25 字数 240 浏览 3 评论 0原文

是否可以为 Windows 窗体实现不同的布局模式而无需手动计算对齐位置?

例如:我有一个表单,应该能够以正常和正常两种模式显示。 触摸屏。 触摸屏模式具有相同的形式,具有更大的按钮、更大的字体,并且应该有对齐问题。

.NET Framework 2.0 是否提供对此类内容的支持? 如果不是,那么实现这一点的最佳方法是什么? 我正在寻找一种可重复使用的策略,我可能想在很多屏幕上使用它

Is it possible to implement different layouting modes for a windows form without having to manual compute the alignment locations?

For example: I have a Form which should be able to displayed in two modes normal & touchscreen. Touch screen mode being the same form with larger buttons, larger fonts and should not have alignment issues.

Does .NET framework 2.0 provide support for something like this? if not what would be the best way to implement this ?
I am looking for a reusable strategy which I might want to use across a lot of screens

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

披肩女神 2024-07-21 20:35:25

我不知道如何在 Winforms 中制作控件的触摸屏“模式”,但我认为它基本上包括缩放控件大小和文本。

如果确实如此,那么可以使用默认的 Winforms 布局策略和布局控件(如 System.Windows.Forsm.TableLayoutPanel)轻松完成布局部分。

只需配置表格布局面板的行数和列数,设置对表单有意义的尺寸的宽度和高度最大和最小尺寸限制,以及需要的控件的 Dock 和 Anchor 样式,并为您的控件的“触摸屏模式”。 Winforms 布局基础设施将使布局根据指定的限制很好地缩放。

我强烈建议您阅读Windows 窗体布局常见问题解答(它更像是教程/指南),以获取有关可以完成的操作的更多信息:(

链接到 Microsoft Word 文档)

http://www.windowsforms.com/Samples/Go%20To%20Market/Layout/layoutGTM .doc

I have no idea of what it takes to make a touchscreen 'mode' of a control in Winforms, but I suppose that it basically consists in scaling control sizes and text.

If that is true, then the layout part could be easily accomplished using the default Winforms layout strategies and layout controls, like the System.Windows.Forsm.TableLayoutPanel.

Just configure the number of rows and columns of the table layout panel, set width and height maximum and minimum size restrictions on the dimensions that make sense to your form, Dock and Anchor styles for the controls that need it, and set new sizes for the 'touchscreen mode' of your controls. The Winforms layout infrastructure will make the layout scale nicely according to the specified restrictions.

I highly recommend reading the Windows Forms Layout FAQ (it is more like a tutorial/guide) for more information of what can be accomplished:

(link to a Microsoft Word document)

http://www.windowsforms.com/Samples/Go%20To%20Market/Layout/layoutGTM.doc

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