C#设置控件大小和位置不同的分辨率 [英] C# Set Control Size and Location Different Resolution

查看:529
本文介绍了C#设置控件大小和位置不同的分辨率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我的所有项目,始终致力于固定分辨率。例子1920x1080 ..但这一次,我不想要这个问题。为此,我尝试了一些解决方案,但所有这些都无法正常工作。



我该怎么办?如何解决这个问题?

Hi all,
My all project, always working on a fixed resolution. Example 1920x1080.. But this time, I don't want this problem. For this, I try some solution but all of them not working.

What can I do? How can fixed this problem?

推荐答案

如果你想让控件在分辨率发生变化时自动调整大小并自动重新定位,那么在Winforms中没有好的解决方案,除了设计应用程序以与Visual Studio类似的方式工作:围绕可变大小的中心文本区域的固定大小的分组控件。

您可以使用Dock和Anchor获取控件以在Winforms中移动和调整自身大小属性,但这不会影响按钮上使用的字体大小 - 例如按钮会增长但文本不会,或者按钮会缩小,文本会消失。



如果您需要一个真正灵活的解决方案,那么您需要考虑更改为WPF - 它可以很好地完成。
If you mean you want controls to resize and reposition automatically when the resolution changes, then there is no good solution in Winforms, except to design the application to work in a similar way to Visual Studio: fixed sized grouped controls around a variable sized central text area.
You can get controls to move and resize themselves in Winforms by using the Dock and Anchor properties, but this does not affect the size of fonts used on buttons for example - the button will grow but the text wont, or the button will shrink and the text disappears.

If you need a truly flexible solution, then you need to look at changing to WPF - it can do it very nicely.


这篇关于C#设置控件大小和位置不同的分辨率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆