I am refactoring a VB6 application. The measurements of any of the controls are in twips. Is it possible in VB6 to set a control to use pixels instead of twips? Thanks
I worked extensively with scalemode back in the day and all I can say is don't bother. It wasn't properly universally supported, which meant that you'll end up converting back to twips for some things anyway.
VB6 is twips based, like it or not, so if you try to do things pixel based, you'll be fighting the current the whole way.
Fortunately VB.net finally ended all that, and is completely pixel based, you can still alter you viewport scaling but .net seems to handle that much better than Vb6.
dim iInPixels as integer
dim iInTwips as integer
iInPixels = 200
iInTwips = iInPixels * Screen.TwipsPerPixelX
iInPixels = iInTwips / Screen.TwipsPerPixelX
As @drventure said, you'll be rowing against the current the whole way, but it really isn't all that bad, as long as you can isolate the logic to a single spot.
Does the ScaleMode Property help?
Returns or sets a value indicating the unit of measurement for coordinates of an object when using graphics methods or when positioning controls.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With