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!

Large Fonts Vs Small Fonts in Windows 1

Status
Not open for further replies.

mohrorless

Programmer
Mar 5, 2002
52
US
I have an app that has some pretty large forms. This requires me to set the resolution for the monitor. That I can do with out any problem.

My problem is there is one user ([clown]) in the office using the application that insists on using large fonts in Window's monitor settings.([hammer]) You can read his screen from across the room. Then he complains that the whole form can't be seen on the screen like everyone else's & that it's my problem & I need to fix it. ([machinegun] [curse])

Is there a way to call out to windows to check the font size being used and change it. Since I can do it for the resolution I would thing I can do it for the font size.

Thanks in advance!

John [spidey] [americanflag] [unclesam]
 
This will tell you if the system font being used is larger than 16 Point, meaning Large Fonts.

Type TEXTMETRIC
tmHeight As Integer
tmAscent As Integer
tmDescent As Integer
tmInternalLeading As Integer
tmExternalLeading As Integer
tmAveCharWidth As Integer
tmMaxCharWidth As Integer
tmWeight As Integer
tmItalic As String * 1
tmUnderlined As String * 1
tmStruckOut As String * 1
tmFirstChar As String * 1
tmLastChar As String * 1
tmDefaultChar As String * 1
tmBreakChar As String * 1
tmPitchAndFamily As String * 1
tmCharSet As String * 1
tmOverhang As Integer
tmDigitizedAspectX As Integer
tmDigitizedAspectY As Integer
End Type

Declare Function GetTextMetrics Lib "gdi32" Alias "GetTextMetricsA" _
(ByVal hdc As Long, lpMetrics As TEXTMETRIC) As Long
Declare Function GetDesktopWindow Lib "user32" () As Long
Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc _
As Long) As Long
Declare Function SetMapMode Lib "gdi32" (ByVal hdc As Long, ByVal _
nMapMode As Long) As Long

Global Const MM_TEXT = 1

Public Function gbl_GetFontRes$()
Dim hdc, hwnd, PrevMapMode As Long
Dim tm As TEXTMETRIC

gbl_GetFontRes$ = "VGA"
hwnd = GetDesktopWindow()
hdc = GetWindowDC(hwnd)
If hdc Then
PrevMapMode = SetMapMode(hdc, MM_TEXT)
GetTextMetrics hdc, tm
PrevMapMode = SetMapMode(hdc, PrevMapMode)
ReleaseDC hwnd, hdc
If tm.tmHeight > 16 Then gbl_GetFontRes$ = "8514"
End If
End Function
William
Software Engineer
ICQ No. 56047340
 
William,

Thanks for pointing me in the right direction! Unfortunately there doesn't seem to be a way to change the font size on the machine in code (yet). The next step is to be able to reliably tell when the user has a font size other than large or small.

I'll post it if I figure anything out.

John [spidey] [americanflag] [unclesam]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top