Hi there,

How could I change the Bitmap Back (Mask) color from Magenta to vbButtonFace (or "Transparent") in the Sub menu of the Menu bar?

I have a 16x16 256 color BMP image loaded into Picture1 (Scale Mode - Pixel)

Name:  vb6_menu_image.png
Views: 290
Size:  4.6 KB

Code:
Option Explicit

Private 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()
 
 Dim hMenu As Long
 Dim hSubMenuFile As Long
 Dim hBitmap As Long

 hMenu = GetMenu(Me.hwnd)
 hSubMenuFile = GetSubMenu(hMenu, 0)
 
 hBitmap = Picture1.Picture.Handle
 
 SetMenuItemBitmaps hSubMenuFile, 0, MF_BYPOSITION, hBitmap, hBitmap
    
End Sub
Is there a simple in-line solution?

Thanks!