问题描述
我开发了一个我和其他人在工作中使用的实用工具。在工作中,我有两个24" 1920x1200显示器。在家我有一个28" 4K显示器。
I have developed a utility that I and others use at work. At work I have a couple of 24" 1920x1200 monitors. At home I have a 28" 4K monitor.
我可以更新代码重新编译和测试,然后蓝色按钮会调整自己的大小。我不知道为什么它会多次编译好然后突然得到所有 弄乱。我的表单变得一团糟,一些停靠或锚定的组件
甚至在表单上都不可见。
I can update the code recompile and test, then out of the blue buttons will resize themselves. I have no idea why it compiles fine for a number of times then suddenly get's all messed up. My form becomes a mess, some components that are docked or anchored are not even visible on the form anymore.
我可以做什么来锁定控件而不让它们改变大小和明显的位置。
What can I do the lock the controls and not have them change size and apparent location.
推荐答案
感谢您发布此处。
您能告诉我们您的项目类型吗? WinForm或UWP或其他项目。
Could you tell us what type of your project? WinForm or UWP or other projects.
在.NET Framework 2.0及更高版本之后支持控件自适应。要查看如何解决此问题的示例,请参阅
。
The control self-adaptation is supported after .NET Framework version 2.0 and later. To see an example of how to resolve this, seeScaling Windows Forms.
.NET Framework 2.0版通过对Windows窗体的自动扩展引入以下更改来克服先前的限制。
The .NET Framework version 2.0 surmounts previous limitations by introducing the following changes to the automatic scaling of Windows Forms.
对扩展的基本支持已移至类,以便表单,本机复合控件和用户控件都可以获得统一的缩放支持。新成员
,,和
PerformAutoScale 已添加。
Base support for scaling has been moved to the ContainerControl class so that forms, native composite controls and user controls all receive uniform scaling support. The new membersAutoScaleFactor, AutoScaleDimensions, AutoScaleMode and PerformAutoScale have been added.
因此,如果您使用的是C#或VB语言,则支持自动缩放。
So if you are using C# or VB language, the automatic scaling has been supported.
最诚挚的问候,
Hart
这篇关于在4k显示器上进行表格开发。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!