Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image menu on a MDI form

Status
Not open for further replies.

BiggerBrother

Technical User
Sep 9, 2003
702
0
0
GB
using vb6, how do i make an image menu, such as the toolbar down the left hand side of outlook express? Needs to be aimed at children, with 6 coloured images, simple text and scrollable if window height isn't great enough. Can't find the control for looking.

Any ideas would be great.

Thanks

BB
 
If u want to have menus with icons (If I have correctly understood what u are saying) then u can use some APIS

If that is what u are looking for . Let me know

Good luck
Vikram
 
i think this is what i'm after. Never had much exprience with api's though. Help would be fantastic

BB
 
Here is ur code , just try it out

Option Explicit

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

Private Declare Function GetMenuCheckMarkDimensions Lib "user32" () As Long

Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long

Private Declare Function CreateBitmap Lib "gdi32" (ByVal nWidth As Long, ByVal nHeight As Long, ByVal nPlanes As Long, ByVal nBitCount As Long, lpBits As Any) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function PatBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal dwRop As Long) As Long



Private Sub Form_Load()
Dim i%
Dim hMenu, hSubMenu, menuID, x
hMenu = GetMenu(hwnd)
hSubMenu = GetSubMenu(hMenu, 0) '1 for "Other" menu etcetera
For i = 1 To 4
menuID = GetMenuItemID(hSubMenu, i - 1)
x = SetMenuItemBitmaps(hMenu, menuID, &H4, img.ListImages(i).Picture, img.ListImages(i).Picture)
Next
menuID = GetMenuItemID(hSubMenu, 5)
x = SetMenuItemBitmaps(hMenu, menuID, 0, img.ListImages(5).Picture, 0&)

End Sub

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 2 Then
PopupMenu mnuMCR, 2, x
End If
End Sub



Good luck

Vikram
 
ok.

tried this code with a image box with 5 images called IMG. What else do i need to do? Don't really understand API. Very grateful for all your help. Thanks

BB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top