Click to See Complete Forum and Search --> : Large Font - Small Font
tppradeep18
Jul 13th, 2000, 02:12 AM
In VB 6.0 how can I detect for Small font or Large Font setting.
Nathan
Jul 13th, 2000, 07:52 AM
Here try this... it's a function that I made a while ago to get the font setting even if a custom size is used. it returns the percentage of the font ie. small font is 96 dpi or 100% and large font is 120 dpi or 125%... I use it for helping to control screen resolution issues from computer to computer...
Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, ByVal nIndex As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" _
(ByVal hwnd As Long, ByVal hdc As Long) As Long
Const LOGPIXELSX = 88
'size of small font
Const SmallFont = 96 'dpi (100%)
Private Function ScreenFont() As Long
'get the font size (in %) that is being used on the current computer
Dim hWnd, hDC, logPix, r As Long
hWnd = GetDesktopWindow()
hDC = GetDC(hWnd)
logPix = GetDeviceCaps(hDC, LOGPIXELSX)
r = ReleaseDC(hWnd, hDC)
ScreenFont = logPix
End Function
tppradeep18
Jul 14th, 2000, 12:53 AM
Thax indeed for that :-). thats fast reply. hmmm!!!
I was using the following technique quite while now using the following one line .....
If GetSystemMetrics(15) <> 19 And QueryValue(HKEY_LOCAL_MACHINE, Config\0001\Display\Settings", "DPIPhysicalX") <> 96 Then
msgbox "This Application works only with system font set to SMALL fonts."
End
End If
.........until i received a call that it worked otherwise. thats how i pressed the panick button. but anyway i will try these. please let me know whats wrong with the above ones...
davem
Jul 21st, 2001, 12:05 AM
Ok... so this tells us what the font scaling is. I have designed my program and it looks really screwed up if the user uses anything other than small fonts... what can I do to change the font scaling? Is there an API that I can call to set the font scaling to 100% (96 dpi) for use in my program?
If not... any ideas on scaling information?
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.