Solved

Coverting twips into pixels by getting the screen resolution

Posted on 1998-10-14
11
431 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

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
 

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

696 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