使用 Visual Studio Designer 处理多种可能的表单布局
当您的表单有多种可能的布局时,是否有一个好方法可以使用 VS 的设计器来提供帮助?
即,假设条件1,您将这些控件放在顶部,将这些控件放在中间,或者条件2,您将这些控件放在顶部,并将这些控件以较大的字体放在左侧。还有诸如此类的各种事情。
看起来这应该很常见,VS 设计师应该能够干净地处理这类事情,但我尝试过的所有东西要么笨重,要么需要在没有设计师支持的情况下手动编码尺寸。是否有处理此类事情的最佳实践?我对 WPF 或 WinForms 解决方案持开放态度。
另外,创建两种不同的表单并不是我真正的偏好,因为大多数控件没有具有动态位置。
Is there a good way to use VS's designer to help in the case where you've got multiple possible layouts for a form?
i.e., say condition1 you put these controls up at the top and those controls in the middle, or condition2 you put those controls up at the top and these controls toward the left in a larger font. And various things like that.
It seems like this should be common enough that VS designer should be able to handle this sort of thing cleanly, but everything I've tried is either clunky or requires hand-coding the dimensions without designer support. Is there a best-practice for handling these sorts of things? I'm open to either WPF or WinForms solutions.
Also, creating two different forms isn't really my preference, since most of the controls don't have dynamic locations.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想到的最好的办法是使用
TabControl
并隐藏选项卡,如 这篇文章Best thing I came up with was using a
TabControl
and hiding the tabs as in this post