Solved

Coverting twips into pixels by getting the screen resolution

Posted on 1998-10-14
11
419 Views
Last Modified: 2010-04-30
I want to make the window size independent of the monitor. So I need to get the screen resolution in twips and pixels. Can anybody help me out.
0
Comment
Question by:lesa
  • 8
  • 3
11 Comments
 
LVL 6

Accepted Solution

by:
clifABB earned 10 total points
ID: 1439853
In twips:
Width = Screen.Width
Height = Screen.Height

In pixels:
Width = Screen.Width / Screen.TwipsPerPixelX
Height = Screen.Height / Screen.TwipsPerPixelY
0
 

Author Comment

by:lesa
ID: 1439854
Lot of thanks for your quick response. Let me make my problem clear.

I have a situaution in which I have to show the window always with a width of 11175twips what ever may be the resolution and width of  the screen.

Can I do this with your solution or should I do anything more.
0
 

Author Comment

by:lesa
ID: 1439855
Lot of thanks for your quick response. Let me make my problem clear.

I have a situaution in which I have to show the window always with a width of 11175twips what ever may be the resolution and width of  the screen.

Can I do this with your solution or should I do anything more.
0
 

Author Comment

by:lesa
ID: 1439856
Lot of thanks for your quick response. Let me make my problem clear.

I have a situaution in which I have to show the window always with a width of 11175twips what ever may be the resolution and width of  the screen.

Can I do this with your solution or should I do anything more.
0
 
LVL 6

Expert Comment

by:clifABB
ID: 1439857
I don't think you are asking the question correctly.

If you want a form to be 11175 twips wide, then you set the width to that value.  However, at 640x480, the form will be bigger than the screen.

I think you want something else, but I'm not sure what.  Could you explain further?

VB defines twips as:
"By default, all Visual Basic movement, sizing, and graphical-drawing statements use a unit of one twip. A twip is 1/20 of a printer’s point (1,440 twips equal one inch, and 567 twips equal one centimeter). These measurements designate the size an object will be when printed. Actual physical distances on the screen vary according to the monitor size."
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:lesa
ID: 1439858
Lot of thanks for your quick response. Let me make my problem clear.

I have a situaution in which I have to show the window always with a width of 11175twips what ever may be the resolution and width of  the screen.

Can I do this with your solution or should I do anything more.
0
 

Author Comment

by:lesa
ID: 1439859
I have a function for whihc I have to pass the size of the width in pixels. For that I have to change the 11175 twips into number of pixels for the monitor resolution ans size as each monitor will have different resolution and size which will effect the no of twips for pixel. So I need to know how can I get number of pixels per 11175 twips.
0
 

Author Comment

by:lesa
ID: 1439860
I have a function for whihc I have to pass the size of the width in pixels. For that I have to change the 11175 twips into number of pixels for the monitor resolution ans size as each monitor will have different resolution and size which will effect the no of twips for pixel. So I need to know how can I get number of pixels per 11175 twips.
0
 
LVL 6

Expert Comment

by:clifABB
ID: 1439861
You can get the number of pixels per 11175 twips by this calculation:
  Number = 11175 / Screen.TwipsPerPixelX

The value of 'Number' will change depending only on resolution but not physical size of the monitor.
0
 

Author Comment

by:lesa
ID: 1439862
I have a function for whihc I have to pass the size of the width in pixels. For that I have to change the 11175 twips into number of pixels for the monitor resolution ans size as each monitor will have different resolution and size which will effect the no of twips for pixel. So I need to know how can I get number of pixels per 11175 twips.
0
 

Author Comment

by:lesa
ID: 1439863
sorry for the delay and lot of thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now