日期:2014-05-17  浏览次数:21049 次

vs2010 winform 怎么获取当前屏幕大小
我现在做的窗体程序,需要在屏幕分辨率不同的情况下运行,怎么取得程序当前运行的屏幕大小,并自动调整好窗体的大小啊,求大神详解,谢啦,最好代码,本人新人

------解决方案--------------------
当前的屏幕除任务栏外的工作域大小
this.Width = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width;
this.Height = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height;

当前的屏幕包括任务栏的工作域大小
this.Width=System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;
this.Height=System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;

任务栏大小
this.Width=System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width-System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width;
this.Height=System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height-System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height;

winform实现全屏显示
WinForm:
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.TopMost = true;
------解决方案--------------------
Screen.PrimaryScreen.Bounds.Width
Screen.PrimaryScreen.Bounds.Height
获得屏幕大小,再作相应处理。
------解决方案--------------------
当前的屏幕除任务栏外的工作域大小
this.Width = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width;
this.Height = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height;

当前的屏幕包括任务栏的工作域大小
this.Width=System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;
this.Height=System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;