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

Pixel to Twip

Status
Not open for further replies.

ZOR

Technical User
Jan 30, 2002
2,963
0
0
GB
Can sizes in Pixels be converted to sizes of Twips. I have some code of a tab control made up of frames etc, but its designed in Pixels, and need to convert it if I can. Thanks
 
then general relationship seems to be

1 pixel = 15 twips

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Many thanks. I'll give it a try. Have a good weekend
 
When working with twips and pixels, I have found theat the number of twips per pixel is device dependent. For instance each monitor and each printer have a different conversion factor. (See the following VB functions Screen.TwipsPerPixelX and Screen.TwipsPerPixelY. Also Printer.TwipsPerPixelX and Printer.TwipsPerPixelY.)
 
If you do a keyword search in this forum, you'll find a fairly long and relatively comprehensive thread concerning twips. In fact, here's a link: thread222-455004
 
Many thanks for all the input. I did do a search earlier but only came near to it with someone who wanted to convert Twips to Pixels. I have been trying to modify someones design of a basic tab control using frames and code to produce shadows/raised edges, but it obviously needs pixels. I would use the standard tab control, but it defaults to such a wide width with 12 tabs even when the legends on the tabs are 1,2,3 etc. There is a property for the tab heights but not widths. Tried putting the tabs sideways but then it was too high. I didn't try removing the tabs to see if it slimmed down. Always a hassle!, why are these people still using 800x600.
 
Interesting. Both the SSTab and The Tabstrip controls have a width setting on this PC (TabMaxWidth in the case of the former, and TabFixedWidth or TabMinWidth in the case of the latter). Which tab control are you using that does not?
 
Thanks strongm. The version I have is MS Tabbed Dialogue control 6(SP5), and only has TabMaxWidth, which is set at 0.
I know there is another control somewhere in the system, but is a pain in the neck adding controls in. If I remember properley it's like a skeleton during design time. The control I am/was using will only slim down in width enough if I set tabs to 3 per row. But I don't want to do that as it's an abortion clicking through tabs in that layout as they re-assemble in confusing order when clicking through them. I think I will just play with switching frames this time round. Thanks the same.
 
Fine. That's the SSTab control. Change the style to ssStylePropertyPage and leave the TabMaxWidth set to 0, and each tab should now resize to fit the text it contains
 
I did exactly what you said, yes it does trim the tab width but the whole control cannot be brought down to a sensible width, its twice the width of the array of tab buttons. Thanks all the same, going down a different road.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top