|
-
Apr 22nd, 2009, 06:41 AM
#1
Thread Starter
Lively Member
how to create icon bar and icons in VB6?
hi,
can anyone tell me how to make an icon in visual basic 6, icons like open, copy,paste, save, save as, run etc on the VB form
and how to create a bar for it as like a bar comes up in menu editor i want a bar below it for icons ..........any help will be appreciated.
thanks
-
Apr 22nd, 2009, 07:20 AM
#2
Re: how to create icon bar and icons in VB6?
VB6 has its own icons library - default location is:
C:\Program Files\Microsoft Visual Studio\Common\Graphics\Icons
However, those are very basic icons so if you want to create your own then you'll need some icon editing utility like Microangelo which is [arguably] the best.
Also if you have all original VB6 installation CDs then one of them has some kind of icon editor but I've never used it.
-
Apr 22nd, 2009, 07:35 AM
#3
Thread Starter
Lively Member
Re: how to create icon bar and icons in VB6?
thanks for your reply, unfortunately i couldnt find the graphics folder.
i found the common folder but i cant found the next thing "graphics" in that.
anyhow, how can i create an "icon bar" on the form and make the icons run. do i have to do any coding for those icons to run?.........like to paste,open, copy, save, save as, run, exit, etc.
-
Apr 22nd, 2009, 07:41 AM
#4
Re: how to create icon bar and icons in VB6?
If you mean toolbar then
- go to Components and add MS Windows Common controls 6.0 to your project.
- then place Toolbar and ImageList controls onto your form.
- then right click on the ImageList and add as many icons as you need
- then right click on your toolbar control and buttons and assign images for each (index or key must be identical from thos in the ImageList)
Adding icons to menus is not as simple - it's actual quite complicated in VB6 and you'll have to use [extensively] Windows API functions.
-
Apr 22nd, 2009, 08:18 AM
#5
Thread Starter
Lively Member
Re: how to create icon bar and icons in VB6?
i am sorry to ask again but i didn't understand how to do this,
- then place Toolbar and ImageList controls onto your form
i added the component but how to place toolbar and image list(actually i added these component to my form but when i right click it nothing specifically comes up as u said) i think i am going wrong.
i am a very very beginner can u tel me how to do this, and how to make use of API for icons, like how can i do that...........i really appreciate for your help.
thanks for your time.
-
Apr 23rd, 2009, 05:41 AM
#6
Thread Starter
Lively Member
Re: how to create icon bar and icons in VB6?
-
Apr 23rd, 2009, 05:55 AM
#7
Re: how to create icon bar and icons in VB6?
Have a look here.
 Originally Posted by hadimohammed365
thanks for your reply, unfortunately i couldnt find the graphics folder.
This troubles me...I can't tell you how many times I've installed VB over the years, and when using a factory created install disk, a graphics folder is always created.
From what did you initially load VB?
-
Apr 23rd, 2009, 06:40 AM
#8
Re: how to create icon bar and icons in VB6?
 Originally Posted by hadimohammed365
i added the component but how to place toolbar and image list(actually i added these component to my form but when i right click it nothing specifically comes up as u said) i think i am going wrong.
i am a very very beginner can u tel me how to do this,
Well there is a simpler way I've never right-clicked a ToolBar or ImageList to add parts.
Once you've added Microsoft Windows Common Controls 6.0, Mscomctl.ocx from Components click on the ToolBar and add it to your Form. Click on the ImageList and add that to your Form. Select the ImageList on the Form and in the properties menu look for Custom property near the top. On the General tab you will see different sizes 16x16, 32x32, 48x48 and Custom each one refers to the size of the icon or you can use Custom for normal pictures but the images won't be proportional if they aren't the same size. Make sure the icons are all the same filesize 1kb, 2kb and 3kb which are 16x16, 32x32, 48x48 icons anything bigger and and VB can't use them as they won't show on the ToolBar.
You can make you're own icons with Imagedit.exe which is on the VB6 CD this topic as been talked about before just do a search. Add the icons in the order you want to see them on the ToolBar. The reason being when you make the buttons you have to allocate an Index to the number of the icon you want to use. Its easy to use 1 for button one and 2 for button two etc.
Once your found all the images/icons click on the ToolBar and again go back to its Custom property. In the ImageList property just select ImageList1 if you haven't changed its name, click Apply. Click on the Buttons tab and you can start to show your buttons, click the Insert Button and fill in all the normal details. Now I generally use the Key when I code the ToolBar but you can use what ever you want too. Put the image number in the Image box and click Apply, you will see the correct image/icon appear on the ToolBar. To add another button click the Insert Button again and repeat the process. If you want to seperate some buttons then you Insert a button as normal then find tbrSeparator in the Style box and click the Apply button again to see the results.
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
-
Apr 23rd, 2009, 07:02 AM
#9
Re: how to create icon bar and icons in VB6?
 Originally Posted by Keithuk
Well there is a simpler way I've never right-clicked a ToolBar or ImageList to add parts...
If you can reasonably explain to me what could possibly be more simple than right clicking on the control and selecting properties from the popup menu...
-
Apr 23rd, 2009, 07:15 AM
#10
Re: how to create icon bar and icons in VB6?
 Originally Posted by RhinoBull
If you can reasonably explain to me what could possibly be more simple than right clicking on the control and selecting properties from the popup menu... 
Nothing really Ive just aways used the Custom property. I didn't find Hack's M$ link very informative.
Ok hadimohammed365 I've just found a tutorial on YouTude for making ToolBar and ImageList. 
http://www.youtube.com/watch?v=anwAE...eature=related
Last edited by Keithuk; Apr 23rd, 2009 at 07:20 AM.
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
-
Apr 23rd, 2009, 07:17 AM
#11
Thread Starter
Lively Member
Re: how to create icon bar and icons in VB6?
thats good idea, i got it now, but can u be able to tell me about the coding part as like the coding for normal options for open, copy, paste,run, exit etc in it. i got the icons now but please suggest me the coding which i can use in common for anymore options(buttons) that i want to put.
do i have to code it individually for each button or does it comes altogther in toolbar.
bcoz i have seen when i pres the every button it is opening the toolbar in coding. so i think i have to code for the given buttons in toolbar code. is it true?
-
Apr 23rd, 2009, 08:24 AM
#12
Re: how to create icon bar and icons in VB6?
 Originally Posted by hadimohammed365
do i have to code it individually for each button or does it comes altogther in toolbar.
Yes and No - each button responds to a click event, however they are all under the same procedure.
When you add buttons to your toolbar make sure you assign key property for each - that could be "open", "print", "save", etc...
And here is how you would use those keys to process individual buttons:
Code:
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case LCase(Button.Key)
Case "open"
'open something
Case "print"
'print something
Case "save"
'save something
Case "exit"
Unload Me
End Select
End Sub
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
|