can we change font of menu bar ?
Printable View
can we change font of menu bar ?
Menu bar or Menu Item?
chem
menu item .
You can't directly, but you can make a picture with the font on it..
The picture needs to be 64x16 big. You need to have a menu created already, with 1 subitem...VB Code:
Private Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long Private Declare Function GetMenuItemID Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long Private Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpString As Any) As Long Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long Private Const SRCCOPY = &HCC0020 ' (DWORD) dest = source Private Const MF_BYPOSITION = &H400& Private Const MF_BITMAP = &H4& Private Sub Form_Load() Dim Width As Integer, Height As Integer Dim hTmpDC As Long, hMenuID As Long Dim hBitmap As Long, retValue As Long Dim tmpID As Long Dim fileName As String Dim menuPos As Integer, menuID As Long menuPos = 0 fileName = App.Path & "\new.bmp" Picture1.Picture = LoadPicture(fileName) Width = 64 Height = 16 hMenuID = GetSubMenu(GetMenu(Me.hwnd), menuPos) hTmpDC = CreateCompatibleDC(Picture1.hdc) hBitmap = CreateCompatibleBitmap(Picture1.hdc, Width, Height) tmpID = SelectObject(hTmpDC, hBitmap) retValue = BitBlt(hTmpDC, 0, 0, Width, Height, Picture1.hdc, 0, 0, SRCCOPY) tmpID = SelectObject(hTmpDC, tmpID) menuID = GetMenuItemID(hMenuID, menuPos) retValue = ModifyMenu(hMenuID, menuPos, MF_BYPOSITION Or MF_BITMAP, menuID, hBitmap) retValue = DeleteDC(hTmpDC) End Sub
chem
With this little app you can add pictures to menu items. You can change the Form font and fontsize to what ever you want and this will change the menu font and fontsize. ;)
Thanks for this mate it was exactly what I was searching for and it works perfectly but we cannot use CheckBoxes on the menu any longer, does anyone know how to make them working again as it is necessary to me?
Thanks!
Cool_Menu still works, but in Windows 7 I initially received the following error:
"Line 28: Class MSComctlLib.ImageList of control ImageList was not a loaded control class."
I believe this is because Component MSCOMCTL.OCX is not not registered.
I resolved this problem by running the following in elevated Command Prompt window:
cd C:\Windows\SysWOW64\
regtlib msdatsrc.tlb