Madboy
Feb 17th, 2004, 04:32 PM
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
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
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!
FIRST WE MAKE THE SUB, IT TELLS US WHERE THE IMAGE LIST IS AND EXTRACTS THE ICONS
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
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!