473,399 Members | 2,278 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

how to find the screen resolution

I've been looking for a way to determine the DPI (PPI) of the screen.

I've found often the suggestion to use:

Dim height As Integer = My.Computer.Screen.Bounds.Height

Dim width As Integer = My.Computer.Screen.Bounds.Width

but that gives the total number of pixels not the DPI (which is usually 96
for pc's).

Can you tell me how to the DPIX and DPIY?

Thanks


May 27 '07 #1
4 11732
On Sat, 26 May 2007 20:30:40 -0400, " active"
<ac**********@a-znet.comwrote:
>I've been looking for a way to determine the DPI (PPI) of the screen.

I've found often the suggestion to use:

Dim height As Integer = My.Computer.Screen.Bounds.Height

Dim width As Integer = My.Computer.Screen.Bounds.Width

but that gives the total number of pixels not the DPI (which is usually 96
for pc's).

Can you tell me how to the DPIX and DPIY?

Thanks
Try this:

Dim dspGraphics As Graphics
dspGraphics = Me.CreateGraphics ' Graphics for user's display
MsgBox(dspGraphics.DpiY)
MsgBox(dspGraphics.DpiX)
dspGraphics.Dispose()
May 27 '07 #2
Works for me!

Thanks
"redear" <re****@nowhere.com.invalidwrote in message
news:8q********************************@4ax.com...
>>
Try this:

Dim dspGraphics As Graphics
dspGraphics = Me.CreateGraphics ' Graphics for user's display
MsgBox(dspGraphics.DpiY)
MsgBox(dspGraphics.DpiX)
dspGraphics.Dispose()

May 27 '07 #3
For those who wants a more standard way

http://groups.google.com/group/micro...d04b502e5ca565

Cor

" active" <ac**********@a-znet.comschreef in bericht
news:e7**************@TK2MSFTNGP03.phx.gbl...
I've been looking for a way to determine the DPI (PPI) of the screen.

I've found often the suggestion to use:

Dim height As Integer = My.Computer.Screen.Bounds.Height

Dim width As Integer = My.Computer.Screen.Bounds.Width

but that gives the total number of pixels not the DPI (which is usually 96
for pc's).

Can you tell me how to the DPIX and DPIY?

Thanks


May 27 '07 #4
I had seen that before I posted but as far as I could tell it only showed
how to get the screen bounds (which is the size) not the DPI.

thanks

"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:OV**************@TK2MSFTNGP02.phx.gbl...
For those who wants a more standard way

http://groups.google.com/group/micro...d04b502e5ca565

Cor

" active" <ac**********@a-znet.comschreef in bericht
news:e7**************@TK2MSFTNGP03.phx.gbl...
>I've been looking for a way to determine the DPI (PPI) of the screen.

I've found often the suggestion to use:

Dim height As Integer = My.Computer.Screen.Bounds.Height

Dim width As Integer = My.Computer.Screen.Bounds.Width

but that gives the total number of pixels not the DPI (which is usually
96 for pc's).

Can you tell me how to the DPIX and DPIY?

Thanks



May 27 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: ZaGras | last post by:
when my vb program run on another computer instead of my computer, the user interface is biggger..this is because of the screen resolution... anyone know how to solve pls?
23
by: Dufe | last post by:
Hello all: To deal with the problem of differing user screen resolutions, I've explored: 1) making the pages in PHP, 2) having different pages on the same page and selecting the proper one via...
4
by: pjac | last post by:
I need some help with some VB language that will change the screen resolution on a monitor when a MS-Access 2000 database is opened from 1024 x 768 to 800 x 600. Any help with this effort would be...
1
by: fabrice | last post by:
Hi, I'm trying to get the screen resolution of the client and to realize a treatment in code behind. it seem to be hard. I can get information about the resolution with this following sub,...
6
by: Darian | last post by:
I am wondering how (if it is possible of course) I can change a users screen resolution to a certain size when running my application and then change it back when they exit my application. For...
5
by: Maxi | last post by:
I have a 30X16 cells table in my html page. Table height and width are set to 100%. I have set size of every cell inside the table to 24 pixel. When I open the html page in maximize state in...
4
by: pedestrian via DotNetMonster.com | last post by:
I'm creating WinForm app. I would like to set the form position according to current Screen resolution. So how could I find the current resolution? Thanks... -- Message posted via...
9
by: Steve Wright | last post by:
Hi I'm developing a webpage that needs to include a different stylesheet depending on the screen resolution. I know that I could read the resolution in javascript and then do some sort of...
1
by: nasima khan | last post by:
Hi, i am nasima. I have got a code for setting the screen resolution of my page, but i am unable to understand. Can any one give a complete data explanation of the below code. Sub ChangeRes(X...
10
by: =?Utf-8?B?UmljaA==?= | last post by:
A lot of users at my workplace use different screen resolutions, and I build apps to use 1680 x 1050 pixels res by default. But some users are using 800 x 600, and the apps are too large for their...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.