Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Large Screen Font Fix?

71 views
Skip to first unread message

Sean

unread,
Aug 16, 2003, 6:09:13 PM8/16/03
to
I have a number of graphical (interface) apps, but if someone turns on large
screen fonts it changes the screen metrics and the forms scale up and causes
huge problems (moving all the controls and making them larger than the
images they contain). Is there anything that can be done? Is there a way to
prevent large screen fonts from making a VB app that uses graphics useless?
I have implemented manual fixes in the past (iterating through the controls
and scaling them back down) but this is only a half fix and for some reason
does not seem to be working on my latest project.

I'm using VB6 if it is of any interest. Any tips or suggestions are much
appreciated!


Grinder

unread,
Aug 16, 2003, 6:33:26 PM8/16/03
to

"Sean" <Se...@NoSpamJustPostToTheGroupPlease.net> wrote in
message news:%23LnjLME...@TK2MSFTNGP09.phx.gbl...

> I have a number of graphical (interface) apps, but if someone
turns on large
> screen fonts it changes the screen metrics and the forms
scale up and causes
> huge problems (moving all the controls and making them larger
than the
> images they contain). Is there anything that can be done? Is
there a way to
> prevent large screen fonts from making a VB app that uses
graphics useless?

Yes, but it involves sizing your form without the presumption
of "Small Fonts" being the norm. I suspect this is a redesign
for you, and it involves too many forms to be practical.

> I have implemented manual fixes in the past (iterating
through the controls
> and scaling them back down) but this is only a half fix and
for some reason
> does not seem to be working on my latest project.

Font selection is a bit of a trap-door function, in that it's
difficult to develop a retroactive inverse function to
"correct" it. I've seen users, however, that benefit from being
able to configure their system this way. How much would it
take for your program to account for this setting? (ie, not
just try to undo it.)


Ken Halter

unread,
Aug 18, 2003, 10:33:21 AM8/18/03
to
If you're moving controls around on the form, be sure to use Screen.TwipsPerPixel(X and Y)
instead of hard coding a specific number of twips. That alone can make a big difference
since Large Fonts gives you 12 twips per pixel and Small fonts returns 15 twips per pixel.
Plus, you can always include the following link somewhere in your help file / other to try
to convince the end user that.....

Large Fonts Suck
http://www.divsoft.com/lfs/

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep it in the groups..


"Sean" <Se...@NoSpamJustPostToTheGroupPlease.net> wrote in message
news:%23LnjLME...@TK2MSFTNGP09.phx.gbl...

Sean

unread,
Aug 18, 2003, 6:16:05 PM8/18/03
to
Ken,

Thanks for the suggestions. I had also posted this question on another
group, so I'll post my reponse here in the hope it might benefit someone:

The problem with that method [using twips and twipsperpixel in all graphic
and control placement calculations] is it has to be implemented throughout
the code. If you're dynamically placing your images and controls, and basing
your calculations (and ScaleMode) on pixels, then no problem exists. A pixel
is still a pixel when placed dynamically. Where I have found the problem is
in static controls. These controls are all scaled up and moved to the right
and down. Therefore in the past I simply developed a small routine that
iterates through the controls. For anyone else who wants to deal with Large
Screen Fonts with an easy and reasonable solution, the method I use is
essentially the following:


Private Sub LargeScreenFontFix()
Dim ScreenMetric As Single
Dim G as Integer
Dim LabType As String

ScreenMetric = Screen.TwipsPerPixelX / 15
If ScreenMetric = 1 Then Exit Sub

For G = 0 To Controls.Count - 1
LabType = Left(LCase(Controls(G).Name), 3)
If LabType = "pic" Or LabType = "lbl" Or LabType = "txt" Or LabType
= "cmd" Then
Controls(G).Left = Controls(G).Left * ScreenMetric
Controls(G).Top = Controls(G).Top * ScreenMetric
Controls(G).Width = Controls(G).Width * ScreenMetric
Controls(G).Height = Controls(G).Height * ScreenMetric
Controls(G).Font = "Arial"
Controls(G).FontSize = 7
End If
Next G

End Sub

It's not commented but what it's doing should be obvious. It may need to be
customized depending on the application, but it's a great solution to the
problem. I found my problem with my latest app was that one of the control
array names I had started with "Pic", rather than "pic". Hence I changed all
control names to lowercase in the code above, and now I'm back up and
running. Hope this helps someone!

All the Best,

Sean


"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message
news:OTm1tWZ...@tk2msftngp13.phx.gbl...

0 new messages