Solved

How change the font size in vb Menu application?

Posted on 2008-10-30
4
1,559 Views
Last Modified: 2013-12-26
I am using VB for develop an application, and i want to know if is possible change the font size of my menu
0
Comment
Question by:emviruena
  • 2
4 Comments
 
LVL 5

Expert Comment

by:JBart_17
ID: 22844445
does not look like you can
http://forums.devx.com/showthread.php?t=39468
 
0
 
LVL 16

Expert Comment

by:robinu
ID: 22844547
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 http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_23674316.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

0
 
LVL 22

Accepted Solution

by:
danaseaman earned 250 total points
ID: 22845665
Changing system parameters is not considered a good practice even if you restore them when you are done. While your program is active, all other apps will have menus modified also. One way around this is to use a custom owner-draw menu that has a Font Property that will not affect other apps.

See HookMenu 1.5 (uses the current Vb menu) at http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=49985&lngWId=1

0
 
LVL 16

Expert Comment

by:robinu
ID: 22845685
You're right. The HookMenu is a better alternative.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now