分辨率在C#中使用Anchor&码头 [英] Resolution Idependent in C# using Anchor & Dock
本文介绍了分辨率在C#中使用Anchor&码头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尊重所有人,
我想在Windows Forms中使用C#作为语言进行独立于分辨率的应用程序。
我希望代码能使我的程序屏幕分辨率独立。
表格,按钮,字体等对于不同的屏幕分辨率看起来大小相同(即800 x 600, 1024 x 768,1280 x 1024.
解决方案
看看这些 Google [ ^ ]结果。
第一个是来自Microsoft的知识库:如何创建与分辨率无关的表格 [ ^ ]。
请查看我过去的解决方案:
当屏幕分辨率发生变化时,Zom Out出现故障 [ ^ ],
GUI Apperance - C#.Net [ ^ ],
在这里找到一个简单的代码示例:如何停靠按钮,以便可以使用表格进行调整 [ ^ ]。
-SA
this .Width = Screen.PrimaryScreen.WorkingArea.Width / 2;
this .Height = Screen.PrimaryScreen.WorkingArea.Height / 2;
this .Top =(Screen.PrimaryScreen.WorkingArea.Top + Screen.PrimaryScreen.WorkingArea.Height)/ 4;
this .Left =(Screen.PrimaryScreen.WorkingArea.Left + Screen.PrimaryScreen.WorkingArea.Width)/ 4;
Respected all,
I would like to make application in Windows Forms that should be resolution independent using C# as language.
I would like the code to make my program screen resolution independent.
Forms, buttons, font, etc will look the same size for different screen resolutions (i.e 800 x 600, 1024 x 768, 1280 x 1024.
解决方案
Have a look at these Google[^] results.
The first one is a knowledge base from Microsoft: How To Create a Resolution-Independent Form[^].
Please see my past solutions:
Zom Out malfunctions when Screen resolution changes[^],
GUI Apperance - C#.Net[^],
find a simple code sample here: how to dock button so that it can adjust with the form[^].
—SA
this.Width = Screen.PrimaryScreen.WorkingArea.Width/2; this.Height = Screen.PrimaryScreen.WorkingArea.Height/2; this.Top = (Screen.PrimaryScreen.WorkingArea.Top + Screen.PrimaryScreen.WorkingArea.Height)/4; this.Left = (Screen.PrimaryScreen.WorkingArea.Left + Screen.PrimaryScreen.WorkingArea.Width)/4;
这篇关于分辨率在C#中使用Anchor&码头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文