Link to home
Start Free TrialLog in
Avatar of SandhiyaKrishnamoorthy
SandhiyaKrishnamoorthy

asked on

How to change the font of the menu items in vb.net

I give up I searched the whole web but was not able to find an answer.

is there a good way to change the fonts of the menu header and menu items in windows forms by vb.net.
Please help?
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America 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
Avatar of arif_eqbal
arif_eqbal

Yu need to Handle the DrawItem Event of all the MenuItems you need to change the Font for.

Write the Following Code on the DrawItem event of each MenuItem or in a Single method that Handles all the Menus DrawItem Event

        'get the Text To Draw
        Dim Txt As String = CType(sender, MenuItem).Text
        'Set The Font Color
        Dim MyBrush As System.Drawing.Brush = System.Drawing.Brushes.Black
        'Set The Font Name & Size
        Dim MyFont As New Font("Verdana", 10, GraphicsUnit.Pixel)
        'Draw The String
        e.Graphics.DrawString(Txt, MyFont, MyBrush, e.Bounds.X, e.Bounds.Y)