برای اضافه نمودن تصویر به منوی برنامه می تونید از این ماژول استفاده کنید
این کار به راحتی صورت می گیره و شکل زیبایی رو به برنامتون میده
برای استفاده به ادامه مطلب مراجعه کنید
نظر فراموش نشه
برای اینکار کد مقابل رو داخل یک ماژول ذخیره کنید
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 String) 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
Public Sub SetMenuPIC(hWnd As Long, pic, Mnu As Byte, MenuItem As Byte)
" Mesal: SetMenuPIC2 Me.hwnd, ImageList1.ListImages(1).Picture, 0
Dim i%
Dim hMenu, hSubMenu, menuID, x
hMenu = GetMenu(hWnd)
hSubMenu = GetSubMenu(hMenu, Mnu) "First SubMenu=0
menuID = GetMenuItemID(hSubMenu, MenuItem)
x = SetMenuItemBitmaps(hMenu, menuID, &H4, pic, pic)
End Sub
Public Sub SetSubMenuPIC(hWnd As Long, pic, Mnu As Byte, subMenu As Byte)
"Mesal: SetSubMenuPIC Me.hwnd, ImageList1.ListImages(5).Picture, 2, 1
Dim i%
Dim hMenu, hSubMenu, menuID, x
hMenu = GetMenu(hWnd)
hSubMenu = GetSubMenu(hMenu, Mnu)
hSubMenu = GetSubMenu(hSubMenu, subMenu)
x = SetMenuItemBitmaps(hMenu, hSubMenu, &H4, pic, pic)
End Sub
Public Sub SetSubMenuItemPIC(hWnd As Long, pic, Mnu As Byte, subMenu As Byte, SubMenuItem As Byte)
"Mesal: SetSubMenuItemPIC Me.hwnd, ImageList1.ListImages(2).Picture, 2, 1, 1
Dim i%
Dim hMenu, hSubMenu, menuID, x
hMenu = GetMenu(hWnd)
hSubMenu = GetSubMenu(hMenu, Mnu)
hSubMenu = GetSubMenu(hSubMenu, subMenu)
menuID = GetMenuItemID(hSubMenu, SubMenuItem)
x = SetMenuItemBitmaps(hMenu, menuID, &H4, pic, pic)
End Sub
Public Sub SetSub2MenuPIC(hWnd As Long, pic, Mnu As Byte, subMenu As Byte, subMenu2 As Byte)
"Mesal: SetSubMenuPIC Me.hwnd, ImageList1.ListImages(5).Picture, 2, 1
Dim i%
Dim hMenu, hSubMenu, menuID, x
hMenu = GetMenu(hWnd)
hSubMenu = GetSubMenu(hMenu, Mnu)
hSubMenu = GetSubMenu(hSubMenu, subMenu)
hSubMenu = GetSubMenu(hSubMenu, subMenu2)
x = SetMenuItemBitmaps(hMenu, hSubMenu, &H4, pic, pic)
End Sub
Public Sub SetSub2MenuItemPIC(hWnd As Long, pic, Mnu As Byte, subMenu As Byte, subMenu2 As Byte, SubMenuItem As Byte)
"Mesal: SetSubMenuItemPIC Me.hwnd, ImageList1.ListImages(2).Picture, 2, 1, 1
Dim i%
Dim hMenu, hSubMenu, menuID, x
hMenu = GetMenu(hWnd)
hSubMenu = GetSubMenu(hMenu, Mnu)
hSubMenu = GetSubMenu(hSubMenu, subMenu)
hSubMenu = GetSubMenu(hSubMenu, subMenu2)
menuID = GetMenuItemID(hSubMenu, SubMenuItem)
x = SetMenuItemBitmaps(hMenu, menuID, &H4, pic, pic)
End Sub
اینم شکل استفاده:

