使用SystemInformation类就行了.
View Code
string
currentScreenSize_OutTaskBar
=
SystemInformation.WorkingArea.Width.ToString()
+
"
,
"
+
SystemInformation.WorkingArea.Height.ToString();
MessageBox.Show( " 当前的屏幕除任务栏外的工作域大小为: " + currentScreenSize_OutTaskBar);
MessageBox.Show( " 当前的屏幕除任务栏外的工作域大小为: " + currentScreenSize_OutTaskBar);
View Code
string
currentScreenSize
=
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width.ToString()
+
"
,
"
+
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height.ToString();
MessageBox.Show( " 当前的屏幕包括任务栏的工作域大小为: " + currentScreenSize);
MessageBox.Show( " 当前的屏幕包括任务栏的工作域大小为: " + currentScreenSize);
View Code
Size OutTaskBarSize
=
new
Size(SystemInformation.WorkingArea.Width, SystemInformation.WorkingArea.Height);
Size ScreenSize = new Size(System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width, System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height);
Size TaskBarSize;
TaskBarSize = new Size(
(ScreenSize.Width - (ScreenSize.Width - OutTaskBarSize.Width)),
(ScreenSize.Height - OutTaskBarSize.Height)
);
MessageBox.Show( " 任务栏大小: " + TaskBarSize.Width + " , " + TaskBarSize.Height);
Size ScreenSize = new Size(System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width, System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height);
Size TaskBarSize;
TaskBarSize = new Size(
(ScreenSize.Width - (ScreenSize.Width - OutTaskBarSize.Width)),
(ScreenSize.Height - OutTaskBarSize.Height)
);
MessageBox.Show( " 任务栏大小: " + TaskBarSize.Width + " , " + TaskBarSize.Height);