如何在基于Winform C#的显示分辨率中自动缩放所有组件? [英] How to auto scale all component in winform C# based display resolution?
本文介绍了如何在基于Winform C#的显示分辨率中自动缩放所有组件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
我的Winform C#窗口有问题.
我在显示器为15.6英寸的笔记本电脑中编写代码,我的winform是全窗口的.但是当我在21英寸缩放窗口的桌面上安装此应用程序时,我的应用程序有很多空间未使用.
我可以自动缩放吗?适应显示器的分辨率吗?
请帮我.谢谢.
Hello
I have a problem with winform C# windows.
I write code in laptop with display 15.6 inchs, my winform is full windows. But when I install this app in desktop 21 inchs, zoom windows, my app have many space is not used.
I can auto scale it? Adaptive with display''s resolution?
Please help me. Thanks.
推荐答案
我们甚至还发表了一篇文章: [只是在Google搜索上有很多结果 [ ^ ].
We have even an article on that: "C# Resize ALL Controls at Runtime"[^].
And you may find many many results just Googling[^].
您应该更好地开发可自动采用任何合理大小的表单的流体布局,而不是自动缩放".基本上,摆脱固定的布局,摆脱手工的大小和位置,根据属性Dock
和Padding
布局所有内容.如果涉及的形状通常比设计尺寸的屏幕大,则可以将其最大化地启动.请查看我过去的答案:
当屏幕分辨率改变时,Zom Out发生故障 [ ^ ],
如何停靠按钮,以便它可以使用以下格式进行调整 [ GUI外观-C#.Net [
Instead of "auto-scaling", you should better develop fluid layout which automatically adopts to any reasonable size of a form. Basically, get away from fixed layout, get rid of manual sizes and positions, layout everything based on the propertiesDock
andPadding
. If it comes to the form which is typically bigger then the screen at its design size, you can start it as maximized. Please see my past answers:
Zom Out malfunctions when Screen resolution changes[^],
how to dock button so that it can adjust with the form[^] (see the rudimentary code sample here).
See also: GUI Apperance - C#.Net[^].
—SA
这篇关于如何在基于Winform C#的显示分辨率中自动缩放所有组件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文