Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

screen resolution

Status
Not open for further replies.

hackproof

Programmer
Feb 29, 2004
41
PH
Hi guys,

Could anyone help me in determining the screen resolution of a pc in VB .Net codes? I working on a project and I'm just new in VB .Net 2005 so could anyone help me on this like giving me an example program to see the codes or something. I tried researching it in the net but I'm having a hard time searching it.
 
Code:
'Check Screen Resolution
Dim sArea As System.Drawing.Rectangle
sArea = Screen.PrimaryScreen.WorkingArea()
Then interrogate sArea.Width and sArea.Height to get your resolution eg 800x600


Sweep
...if it works dont f*** with it
...if its f****ed blame someone else
...if its your fault that its f***ed, say and admit nothing.
 
If you want the actual size of the screen you can use SystemInformation.VirturalScreen. If you need the working area (minus taskbar and any dockbars) use SystemInformation.WorkingArea.

Maybe this world is another planet’s Hell.
 
Thanks guys, your a big help. Do you also know how the change the screen resolution in codes to my desired settings?
 
Rather than changing the resolution, I would simply report an error message to the user, saying that the current screen resolution is insufficient. Im not sure how or if it can be changed via code, but unless there is a way of checking what resolutions are allowed, this is risky, as you may be changing the graphics mode, to a mode which is not supported.

We've all come across users who have 800x600 desktops, and insist it must stay that way, but then your app is designed for say 1024x768. All I wil say is that if your application is written using the latest technologies, then surely the hardware it runs on should be sufficient. I always declare a minimum specification for any PC that any app will run un, and include screen res in that same spec.


Sweep
...if it works dont f*** with it
...if its f****ed blame someone else
...if its your fault that its f***ed, say and admit nothing.
 
Thanks guys for the help. Do you know some other way to do this without using API? Just use the components that VB .Net already have?
 
Thanks guys for the help. Do you know some other way to do this without using API? Just use the components that VB .Net already have?
The example given doesn't use an API call...


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Sorry guys, I forgot to ask on how to change the screen resolution without using an API to the desired resolution I wanted programmatically.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top