XP Smart Menu - Adding icons
THIS EXAMPLE I MADE SHOWS YOU HOW TO ADD ICONS EVEN EASIER. USING AN IMAGE CONTROL
FIRST WE MAKE THE SUB, IT TELLS US WHERE THE IMAGE LIST IS AND EXTRACTS THE ICONS
VB Code:
Option Explicit
Private Function pGetPicture(sFileName As String) As StdPicture
Dim c As Long
For c = 1 To frmMain.imlMain.ListImages.Count
If LCase(frmMain.imlMain.ListImages(c).Key) = LCase(sFileName) Then
Set pGetPicture = frmMain.imlMain.ListImages(c).ExtractIcon
End If
Next
End Function
NOW WE BUILD THE MENU, HERE IS A COPIED PART OF MY PROJECT
VB Code:
Public Sub BuildMainMenu()
With frmMain.mnuMain.MenuItems
.Add 0, "KeyFile", , "&File"
.Add "KeyFile", "KeyExit", , "E&xit", pGetPicture("EXIT"), vbAltMask, vbKeyQ
End With
End Sub
HOPE THIS WAS USEFUL, ITS MUCH BETTER THAN USING RESOURCE FILES!
Re: XP Smart Menu - Adding icons
Quote:
Originally posted by Madboy
HOPE THIS WAS USEFUL, ITS MUCH BETTER THAN USING RESOURCE FILES!
Why? :confused:
Re: XP Smart Menu - Adding icons
Can you post a sample program? I always get a method or data not found on the ".menuItems" part. :blush: . Newbie here
Re: XP Smart Menu - Adding icons
Well im no longer a VB programmer, but maybe someone else could help you?