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 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 Const MF_bitmap = &H4& Private Sub Form_Load() '为“进货管理”菜单下的子菜单添加图标 Dim i As Integer Dim menu1 As Long Dim menuID As Long menu1 = GetMenu(Me.hwnd) For i = 1 To 4 menuID = GetMenuItemID(GetSubMenu(menu1, 0), i - 1) SetMenuItemBitmaps menu1, menuID, MF_bitmap, ImageList2.ListImages(i).Picture, ImageList2.ListImages(i).Picture Next End Sub Private Sub file_exit_Click() End End Sub Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button) Select Case Button.Key Case Is = "quit" End End Select End Sub
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 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
Const MF_bitmap = &H4&
Private Sub Form_Load()
'为“进货管理”菜单下的子菜单添加图标
Dim i As Integer
Dim menu1 As Long
Dim menuID As Long
menu1 = GetMenu(Me.hwnd)
For i = 1 To 4
menuID = GetMenuItemID(GetSubMenu(menu1, 0), i - 1)
SetMenuItemBitmaps menu1, menuID, MF_bitmap, ImageList2.ListImages(i).Picture, ImageList2.ListImages(i).Picture
Next
End Sub
Private Sub file_exit_Click()
End
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case Is = "quit"
End
End Select
End Sub
选择imagelist在属性窗口中的“(自定义)”(属性页),插入一系列工具条所需的图标,记住索引号
选择toolbar在属性窗口中的“(自定义)”(属性页),将“图像列表”设为imagelist的名称。在按钮选项卡中,插入按钮,输入标题、关键字,设置好选项,“图像”为imagelist中所需图像的索引号
是这样的呀。