Reputation: 4997
I am writing an application that generates graphs. I need to set the bar size according to the size of screen (in pixels) How can I get the total screen size in pixels using vb.net code?
Upvotes: 2
Views: 6039
Reputation: 7310
You can use:
Screen.PrimaryScreen.Bounds.Width
Screen.PriamryScreen.Bounds.Height
or:
My.Computer.Screen.Bounds.Width
My.Computer.Screen.Bounds.Height
Alternatively you can look at Screen.WorkingArea
which gives you the dimensions of the working area (that excludes docked windows, toolbars etc.)
Upvotes: 4
Reputation: 89102
Screen.PrimaryScreen.Bounds.Width
Screen.PrimaryScreen.Bounds.Height
Upvotes: 3
Reputation: 31239
Maybe something like this:
Dim intX As Integer = Screen.PrimaryScreen.Bounds.Width
Dim intY As Integer = Screen.PrimaryScreen.Bounds.Height
Upvotes: 1