Menu Color Using VB 6.0

Untitled

‘——————–For Mnue Colour———————————————————————-
Private Const MIM_BACKGROUND As Long = &H2
Private Const MIM_APPLYTOSUBMENUS As Long = &H80000000

Private Type MENUINFO
cbSize As Long
fMask As Long
dwStyle As Long
cyMax As Long
hbrBack As Long
dwContextHelpID As Long
dwMenuData As Long
End Type

Private Declare Function DrawMenuBar 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 GetMenu Lib “user32″ _
”'(ByVal hWnd As Long) As Long

Private Declare Function SetMenuInfo Lib “user32” _
(ByVal hMenu As Long, _
mi As MENUINFO) As Long

Private Declare Function CreateSolidBrush Lib “gdi32” _
(ByVal crColor As Long) As Long
‘———————–Menu Color End———————————————————————

‘*********** Menu Colour **********
Private Sub ManuColour()
Dim mi As MENUINFO

With mi
.cbSize = Len(mi)

.fMask = MIM_BACKGROUND
.hbrBack = CreateSolidBrush(RGB(255, 255, 255))
SetMenuInfo GetMenu(Me.hWnd), mi ‘main menu bar
.fMask = MIM_BACKGROUND Or MIM_APPLYTOSUBMENUS
.hbrBack = CreateSolidBrush(RGB(139, 201, 242))
SetMenuInfo GetSubMenu(GetMenu(Me.hWnd), 0), mi ‘File menu (item 0)
.hbrBack = CreateSolidBrush(RGB(139, 201, 242))
SetMenuInfo GetSubMenu(GetMenu(Me.hWnd), 1), mi ‘Edit menu (item 1)
.hbrBack = CreateSolidBrush(RGB(139, 201, 242))
SetMenuInfo GetSubMenu(GetMenu(Me.hWnd), 2), mi ‘Select menu (item 2)
.hbrBack = CreateSolidBrush(RGB(139, 201, 242))
SetMenuInfo GetSubMenu(GetMenu(Me.hWnd), 3), mi ‘Select menu (item 2)
End With
DrawMenuBar Me.hWnd
End Sub

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s