如何适应任何屏幕分辨率的C#窗口 [英] how to fit C# windows from for any screen resolution

查看:144
本文介绍了如何适应任何屏幕分辨率的C#窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮帮我,我急需为我的客户电脑设置表格



谢谢

please help me i need urgently to set my forms for my clients computers

thanks

推荐答案

甚至不要尝试。

除非您的表单是从头开始设计的,可以重新调整大小(与Visual Studio的中心工作区改变大小的方式相同,并且没有好的方法可以使过程自动化。



问题是虽然很容易使用自动调整控件大小Dock和Anchor属性,它们也不会自动改变文本的大小 - 所以你最终会得到文本太小的按钮,或者巨大按钮中间的小文本。



WPF在这方面要好得多,但即使这样也有点痛苦(意味着学习一个全新的界面框架)
Don't even try.
Unless your form was designed from the ground up to be re-sizable (in the same way that Visual Studio is with a central "work area" that changes size, and with tool boxes around the edges that don't) there is no good way to make the process automatic.

The problem is that while it's easy to resize controls automatically using the Dock and Anchor properties, they don't change the size of text automatically as well - so you end up with buttons too small for the text, or tiny text in the middle of a huge button.

WPF is a lot better in this regard, but even then it's a bit of a pain (and means learning a whole new interface framework)


你试过吗?谷歌?我刚刚在google中复制并粘贴了你的问题标题,并且发现了很多。



但是,如果这是一个Windows窗体应用程序,那么你可以使用这个:

Have you tried google? I just copied and pasted your question title in google and found quite a bit.

But never the less if this is for a windows form application then you can use this:
this.Size = Screen.PrimaryScreen.WorkingArea.Size;
this.WindowState = FormWindowState.Maximized;


这篇关于如何适应任何屏幕分辨率的C#窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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