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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Twip To Pixel

Status
Not open for further replies.

MrVB50au

Programmer
Mar 16, 2003
326
AU
Hi all,

I have a problem that I hope any of you can solve for me.

An image control does not have the property to allow you to change from twip to pixel

I want to scale a picturebox to fit the picture, this is to tile for background.

What I thought is if I can use the image control the stretch property set to 'False' and a picture box that, at runtime will size itself to size of image. But the image has no property to change from Twip to Pixel.

How can I achieve the result I want?

Thanking you for your time to help.

Andrew G.
 
could you use the fact that an inch is approximately 1440 twips and a centimeter is approximately 567 twips. then use your screen resolution to figure out how many centimeters or inches you have...

maybe?!?!

good luck!

If somethings hard to do, its not worth doing - Homer Simpson
------------------------------------------------------------------------
A General Guide To Excel in VB FAQ222-3383
 
if you know the size of your image then just set
image1.width = screen.TwipsPerPixelX * lPictureWidth
image1.height = screen.TwipsPerPixelY * lPictureHeight

How you get the height and width of the actual picture is up to you.

 
I just wanted a fragment of code so I know how to convert twips to pixels.

Thank you for your help anyway.

Andrew G.
 
Twips to pixels is just don by multiplying the length by screen.twipsperpixelx or .twipsperpixely

Note pixels don't have to be square.
 
Speaking of Twips to Pixels.

Why is it called Twips? Can anyone educate me in this please? :)

Andrew G.

 
Something tells me that knowing these types of obscure facts that I should just jump off this building now 8)
 
Just like the N in BNC does NOT stand for Network as many people think but Naval. Some people say that it stands for Bayonet Neil-Concelman for the connection type and 2 inventors names.....but I'll go with the original registration for a pattent logged that list it as British Naval Connector.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top