what is the relationship between twip and pixel?

bergie

Member
Joined
Jun 22, 2004
Messages
12
Programming Experience
3-5
1 pixel = ? twips

thx. i can't find it in the textbook. theory always far from practicing :eek:
 
I believe it depends on the screen resolution. I recall lower resolutions being 15 and higher being 12 in some past work. There used to be a ScaleX function that would convert it if you want to research that in the VB6 docs.
 
thank you. for i use the msflexgrid control and it's in twips, i want to change it to the pixels in order for positioning. and i have some ideas below:
1. get the metrics of the display. that is first get the resolution and the display's physical size. then the twipsperpixel can be find out.
but this method's problem is it is hardly for me to get the physical size of the display.
2. find where i can use TwipsPerPixelX(Y), in VB.net it is no longer to support this function(s). but i find it in msdn 2003 (the URL is ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.2052/vbcon/html/vbup2038.htm)
it is written that we can use TwipsPerPixelX in the name space VB6. ie. VB6.TwipsPerPixelX, i tried,but it cannot recognize the VB6 namespace. then i write the code in the VB6, and let VB.net change it automatically, i can see "VB6" in the code in use. i don't know the reason.

do you have some ideas? thx. :eek:
 
A twip (twentieth of a point) is really a measure more useful in traditional printing because it represents absolute distance. A twip is 1/1440th of an inch or 1/567th of a centimeter. That is, there are 1440 twips to an inch or 567 twips to a centimeter.

A pixel (short for "picture element") is the basic unit of programmable color on a computer display or in a computer image. Think of it as a logical - rather than a physical - unit. The physical size of a pixel depends on how you've set the resolution for the display screen.


VB .NET, however, has dropped support for the twip and the Upgrade Wizard automatically converts them into pixels using calls in the VB .NET "compatibility library".

... they realized that a form is an object that is meant to be displayed on a computer monitor. A pixel is the unit native to that environment.

From Dan Mabbutt,
Your Guide to Visual Basic

http://visualbasic.about.com/cs/ourownfaq/a/dykpixeltwip.htm
 
bergie said:
2. find where i can use TwipsPerPixelX(Y), in VB.net it is no longer to support this function(s). but i find it in msdn 2003 (the URL is ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.2052/vbcon/html/vbup2038.htm)
it is written that we can use TwipsPerPixelX in the name space VB6. ie. VB6.TwipsPerPixelX, i tried,but it cannot recognize the VB6 namespace. then i write the code in the VB6, and let VB.net change it automatically, i can see "VB6" in the code in use. i don't know the reason.

do you have some ideas? thx. :eek:
Try this:

Imports Microsoft.VisualBasic.Compatibility.VB6

Then in your code, just use TwipsPerPixelX or Y.
 
i think it's something like 10024 twips = 1 pixel or something, there is a weird conversion factor cause (as they've said) the measureing environment are completely different

vb.net does still handle twips if you add a PrintDocument control to your form the PrintPage event allows you to specify page locations (and text/image) sizes and all dat with e.measurestring and e.drawstring those deal with twips (you dont see it) but it does
 
Back
Top