|
-
Feb 17th, 2004, 05:32 PM
#1
Thread Starter
Supreme User
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!
-
Feb 17th, 2004, 05:49 PM
#2
-
Feb 17th, 2004, 06:59 PM
#3
Thread Starter
Supreme User
Because,
a) the way i used resource files, made the icons appearance slightly dodgee
b) you dont have to mess about adding them to the resource file
c) You dont need a huge module like i did just to load the icons
d) Resource Hacker cant view your icons as they are stored internally into a Image List
e) The compiled file size is slightly less, no big difference.
f) Resource Editor is fussy when loading icons, they have to be a falid format or they wont load.
Does that conclude my original post
-
Feb 18th, 2004, 08:17 AM
#4
-
May 4th, 2004, 02:16 PM
#5
Thread Starter
Supreme User
Good
-
Jun 1st, 2004, 09:26 AM
#6
Frenzied Member
I changed your function to use the Index integer value instead, I find it a lot easier to use =) :
VB Code:
Private Function pGetPicture(iIndex As Integer) As StdPicture
Dim c As Long
For c = 1 To frmMain.imlMain.ListImages.Count
If LCase(frmMain.imlMain.ListImages(c).Index) = LCase(iIndex) Then
Set pGetPicture = frmMain.imlMain.ListImages(c).ExtractIcon
End If
Next
End Function
"Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
- Zack de la Rocha
Hear me roar.
-
Jun 3rd, 2004, 04:08 AM
#7
Thread Starter
Supreme User
Ah, ok cheers
Do you use the XP Smart Menu?
-
Jun 3rd, 2004, 04:19 AM
#8
Frenzied Member
Not often, but yes, sometimes I do - mostly to spice up the boring interfaces I make =).
"Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
- Zack de la Rocha
Hear me roar.
-
Mar 4th, 2005, 01:04 PM
#9
Addicted Member
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. . Newbie here
-
Aug 9th, 2005, 06:41 PM
#10
Thread Starter
Supreme User
Re: XP Smart Menu - Adding icons
Well im no longer a VB programmer, but maybe someone else could help you?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|