如何根据C#中任何监视器的分辨率大小更改应用程序的窗口大小 [英] how to change the application's window size according to the resolution size of any monitor in C#
问题描述
如何根据C#中任何显示器的分辨率大小更改应用程序的窗口大小
i已经完成了一个Windows应用程序,我还创建了一个安装文件在VS studio 2005中使用相同的应用程序。
当我在任何其他系统中安装应用程序时,窗口状态最大化但我只能看到我真实窗口的一半带有我用来控制的窗口请参阅我的开发系统。
我该怎么做才能更改窗口中的窗口大小和控件,以根据我安装窗口应用程序的任何system.s montior的屏幕分辨率自动更改/>
i开始知道.Net中的SCREEN课程会有所帮助,但无法对该课程有任何想法/结论
i已在C#2.0中开发<div class =h2_lin>解决方案
System.Drawing.Rectangle workingRectangle =
Screen.PrimaryScreen.WorkingArea ;
这将为您提供显示器的工作区高度和宽度。
int widthVal = workingRectangle.Width;
int heightVal = workingRectangle.Height;
好运。
intX = Screen.PrimaryScreen.Bounds.Width;
intY = Screen.PrimaryScreen.Bounds.Height;
u可以使用上面的代码获取屏幕宽度和高度
然后将intx和inty传递给屏幕
this .Width = intX;
this .Height = intY;
this .Refresh();
但是对于控件你可以使用其他方式来锚定编码。
请参考以下链接
http://www.c-sharpcorner.com/UploadFile/harishankar2005/AnchoringinWindowsForms11302005051741AM
/AnchoringinWindowsForms.aspx
http://www.c-sharpcorner.com/UploadFile/c5c6e2
/动态调整大小控制在windows-forms-使用-ancho /
谢谢
AravindB
how to change the application's window size according to the resolution size of any monitor in C#
i have done a windows application and also i created a setup file for the same application in VS studio 2005.
When i install the application in any other system, the window state is maximised but i can only see, half of the side of my real window with controls which i use to see in my development system.
What can i do to change the windows size and controls present in the window to automatically change according to screen resolution of any system.s montior where i install my window's application
i came to know that SCREEN class in .Net will be helpful but not able to get any idea/conclusion with that class
i have developed in C# 2.0
System.Drawing.Rectangle workingRectangle = Screen.PrimaryScreen.WorkingArea;
This will fetch you the working area Height and width for the monitor.
int widthVal=workingRectangle.Width; int heightVal=workingRectangle.Height;
Best of luck.
intX = Screen.PrimaryScreen.Bounds.Width; intY = Screen.PrimaryScreen.Bounds.Height;
u can use above code get screen width and height
and then pass intx and inty to screen
this.Width = intX ; this.Height = intY ; this.Refresh();
but for controls u have use some other way like Anchor codings.
pls refer following link
http://www.c-sharpcorner.com/UploadFile/harishankar2005/AnchoringinWindowsForms11302005051741AM
/AnchoringinWindowsForms.aspx
http://www.c-sharpcorner.com/UploadFile/c5c6e2
/dynamically-resizing-controls-on-windows-forms-using-ancho/
Thanks
AravindB
这篇关于如何根据C#中任何监视器的分辨率大小更改应用程序的窗口大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!