安然不哭-西坝阿超个人博客

做技术一定要一颗恒心,这样才不会半途而废。

winfrom 获取当前屏幕的分辨率

2018-5-22 钟建超

当前的屏幕除任务栏外的工作域大小
   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;  

标签: c#