Link to home
Start Free TrialLog in
Avatar of emviruena
emviruena

asked on

How change the font size in vb Menu application?

I am using VB for develop an application, and i want to know if is possible change the font size of my menu
Avatar of JBart_17
JBart_17
Flag of United States of America image

does not look like you can
http://forums.devx.com/showthread.php?t=39468
 
Avatar of Robin Uijt
You can by using the module 'modSysFonts' from http://www.thevbzone.com/modSysFonts.bas

and the following sample code (changes the font for the menu):



(answer also found on https://www.experts-exchange.com/questions/23674316/How-to-change-the-font-system-for-ative-title-bar-menu-message-box-in-VB-at-runtime.html)



    Dim PreviousFont As StdFont
    Dim NewFont      As StdFont
 
    ' Get the previous font to be able to set it back to what it was before
    If GetSysFontA(PreviousFont, Me.hDC, cf_Menu) = True Then
        ' Create a new font to set it to
        Set NewFont = New StdFont
        With NewFont
            .Bold = False
            .Italic = False
            .Name = "Verdana"
            .Size = 16
            .Strikethrough = False
            .Underline = False
        End With
        ' Set the font to the newly created one
        If SetSysFontA(NewFont, Me.hDC, cf_Menu) = False Then
            MsgBox "ERROR"
        Else
            MsgBox "SUCESS!"
        End If
        ' Restore the font to what it was before
        SetSysFontA PreviousFont, Me.hDC, cf_Menu, True
    End If

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Dana Seaman
Dana Seaman
Flag of Brazil image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You're right. The HookMenu is a better alternative.