-
Jan 27th, 2006, 02:07 AM
#1
Thread Starter
Member
Giving BackColor to MENU n TABCONTROL
How can I give back color and icons in the Menu. Also, how can I give backcolor to the TabControl, in VB 6.0
is there any third party conponent or dll available for that.
Thanx
-
Jan 27th, 2006, 02:10 AM
#2
Frenzied Member
Re: Giving BackColor to MENU n TABCONTROL
yes there is, you can make use of vbaccelerator
click here
http://www.vbaccelerator.com
On error goto Trap
Trap:
in case of emergency, drop the case...
****************************************
If this post has been resolved. Please mark it as "Resolved" by going through the "Thread Tools" above and clicking on the "Mark Thread Resolved " option. if a post is helpful to you, Please Rate it by clicking on the Rate link right below the avatar
-
Jan 27th, 2006, 07:21 AM
#3
Re: Giving BackColor to MENU n TABCONTROL
-
Jan 27th, 2006, 09:01 AM
#4
Re: Giving BackColor to MENU n TABCONTROL
to give Icons to Menu:
VB Code:
Const MF_BYPOSITION = &H400&
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 SetMenuItemBitmaps Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, ByVal hBitmapUnchecked As Long, ByVal hBitmapChecked As Long) As Long
Private Sub Form_Load()
'KPD-Team 2000
'URL: [email]KPDTeam@Allapi.net[/email]
'E-Mail: [email]KPDTeam@Allapi.net[/email]
Dim hMenu As Long, hSubMenu As Long
'get the handle of the menu
hMenu = GetMenu(Me.hwnd)
'check if there's a menu
If hMenu = 0 Then
MsgBox "This form doesn't have a menu!"
Exit Sub
End If
'get the first submenu
hSubMenu = GetSubMenu(hMenu, 0)
'check if there's a submenu
If hSubMenu = 0 Then
MsgBox "This form doesn't have a submenu!"
Exit Sub
End If
'set the menu bitmap
SetMenuItemBitmaps hSubMenu, [b]0[/b], MF_BYPOSITION, Image1.Picture, Image1.Picture
End Sub
where the bold 0 represents the submenu number starting from 0.
-
Jan 27th, 2006, 09:05 AM
#5
Re: Giving BackColor to MENU n TABCONTROL
to change the color of Menu bar, try this, posted by Jcis (in some post)
VB Code:
Option Explicit
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 GetMenu Lib "user32" _
(ByVal hwnd As Long) As Long
Private Declare Function GetSystemMenu Lib "user32" _
(ByVal hwnd As Long, _
ByVal bRevert 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
Private Declare Function OleTranslateColor Lib "olepro32.dll" _
(ByVal OLE_COLOR As Long, _
ByVal HPALETTE As Long, _
pccolorref As Long) As Long
Private Const MIM_BACKGROUND As Long = &H2
Private Const MIM_APPLYTOSUBMENUS As Long = &H80000000
Private Function SetMenuColour(ByVal hwndfrm As Long, _
ByVal dwColour As Long, _
ByVal bIncludeSubmenus As Boolean) As Boolean
'set application menu colour
Dim mi As MENUINFO
Dim flags As Long
Dim clrref As Long
'convert a Windows colour (OLE colour)
'to a valid RGB colour if required
clrref = TranslateOLEtoRBG(dwColour)
'we're changing the background,
'so at a minimum set this flag
flags = MIM_BACKGROUND
If bIncludeSubmenus Then
'MIM_BACKGROUND only changes
'the back colour of the main
'menu bar, unless this flag is set
flags = flags Or MIM_APPLYTOSUBMENUS
End If
'fill in struct, assign to menu,
'and force a redraw with the
'new attributes
With mi
.cbSize = Len(mi)
.fMask = flags
.hbrBack = CreateSolidBrush(clrref)
End With
SetMenuInfo GetMenu(hwndfrm), mi
DrawMenuBar hwndfrm
End Function
Private Function TranslateOLEtoRBG(ByVal dwOleColour As Long) As Long
OleTranslateColor dwOleColour, 0, TranslateOLEtoRBG
End Function
Private Sub Form_Load()
'Change RGB(180, 210, 240) to the color you want
Call SetMenuColour(Me.hwnd, RGB(255, 255, 0), True)
End Sub
i tried something similar for Tabcontrol, but no success, but you may search here. i am sure you will get some positive results.
-
Jan 27th, 2006, 01:49 PM
#6
Re: Giving BackColor to MENU n TABCONTROL
To change menu background see link in my signature.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|