用API: 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
'This project needs a form with a menu with at least one submenu 'It also needs a picturebox, Picture1, that contains a small b/w bitmap 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 protected] 'E-Mail: [email protected] 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, 0, MF_BYPOSITION, Picture1.Picture, Picture1.Picture End Sub
To shawls(小山(坚持VB,学Delphi和C#)):贴我的呀!做成那样的菜单有两种方法: 一:自画菜单: 我编的自画菜单(有注释!特地为想学自画菜单的人写的):下载:http://go6.163.com/910grtd/vb/wdzp/DrawMenu-S.zip 界面:http://go6.163.com/910grtd/vb/wdzp/DrawMenu-S.gif二:用窗体模拟菜单: http://www.dapha.net/soure/form/XP%20(or%20.NET)%20menu%20with%20sh XP下拉菜单(影子效果)
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
SetMenuItemBitmaps GetMenu(), 1,MF_BYPOSITION, imgMyPic.Picture.Handle,imgMyPic.Picture.Handle这样就可以。
的办法不好!http://go6.163.com/910grtd/vb/wdzp/DrawMenu-S.zip的比较好!!!
如果要简单,用activebar2控件最简单
'It also needs a picturebox, Picture1, that contains a small b/w bitmap
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 protected]
'E-Mail: [email protected]
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, 0, MF_BYPOSITION, Picture1.Picture, Picture1.Picture
End Sub
一:自画菜单:
我编的自画菜单(有注释!特地为想学自画菜单的人写的):下载:http://go6.163.com/910grtd/vb/wdzp/DrawMenu-S.zip
界面:http://go6.163.com/910grtd/vb/wdzp/DrawMenu-S.gif二:用窗体模拟菜单:
http://www.dapha.net/soure/form/XP%20(or%20.NET)%20menu%20with%20sh
XP下拉菜单(影子效果)