Sometimes you may need to get your current screen resolution or even your current working Area. .Net made so easy to get screen resolution in just one line of code. The below sample stimulates the scenario
C#
private void button1_Click(object sender, EventArgs e) { MessageBox.Show(Screen.PrimaryScreen.Bounds.Width + " x " + Screen.PrimaryScreen.Bounds.Height); //The below code gets Working area of screen, excluding taskbar, docked windows and doc panels MessageBox.Show(Screen.PrimaryScreen.WorkingArea.Width + " x " + Screen.PrimaryScreen.WorkingArea.Height); }
VB.Net
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click MessageBox.Show(Screen.PrimaryScreen.Bounds.Width.ToString() + " x " + Screen.PrimaryScreen.Bounds.Height.ToString()) 'The below code gets Working area of screen, excluding taskbar, docked windows and doc panels MessageBox.Show(Screen.PrimaryScreen.WorkingArea.Width.ToString() + " x " + Screen.PrimaryScreen.Bounds.WorkingArea.ToString()) End Sub