Furqan Sehgal
Furqan Sehgal

Reputation: 4997

How to get total pixel size of the screen

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

Answers (3)

MMM
MMM

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

Jason
Jason

Reputation: 89102

Screen.PrimaryScreen.Bounds.Width
Screen.PrimaryScreen.Bounds.Height

Upvotes: 3

Arion
Arion

Reputation: 31239

Maybe something like this:

Dim intX As Integer = Screen.PrimaryScreen.Bounds.Width
Dim intY As Integer = Screen.PrimaryScreen.Bounds.Height

Upvotes: 1

Related Questions