|
-
Sep 10th, 2000, 02:19 AM
#1
Thread Starter
Addicted Member
Will someone show me how to make a toolbar. I don't know where to start. How to add the icons?
Thanks
-
Sep 10th, 2000, 05:05 AM
#2
Fanatic Member
Do you mean making one from scratch or using the Common Controls OCX?
-
Sep 10th, 2000, 06:02 AM
#3
Thread Starter
Addicted Member
I mean like when you run the wizard and the toolbar that automatically comes with the program.
-
Sep 10th, 2000, 06:23 AM
#4
Fanatic Member
That just uses the Common Controls OCX.
Add it by pressing Ctrl+T, scrolling down to Microsoft Common Conrols and checking it. Then just click ok.
One of the new buttons that have appeared will say toolbar when you move your mouse over it. Click on that. The just add it to your form.
From there, left click on it and select properties, in the General Tab, set it to an ImageList control on your form
then move to the central tab, 'Buttons' and click on insert button. Then in the 'Image' attribute put the key of the picture you would like to go with it from the ImageList control. To access all the images and their keys in the ImageList control at design-time, left click on it and select properties, and scroll to the image you wish to use for that button. And its 'Key' attribute is there.
I think that should do it. Phew!
-
Sep 10th, 2000, 06:43 AM
#5
VB6 also comes with a Toolbar Wizard that makes it even easier to add a toolbar to a form.
Select the Add-Ins menu and if you don't have a menu item called Toolbar Wizard there then click on Add-In Manager.
Select VB 6 Application Wizard in the list box and check the "Loaded/Unloaded" and the "Load On Startup" check boxes, click on OK.
Now you have the Toolbar Wizard on the Add-In menu.
Good luck!
-
Sep 10th, 2000, 03:52 PM
#6
Thread Starter
Addicted Member
Under the toolbar properties, what is "Disabledimagelist", "Hotimagelist", "Button menus" and "description"?
-
Sep 10th, 2000, 04:35 PM
#7
Fanatic Member
Try this one Shark. I remodified this from the MSDN.
Add three imagecontrols and renamed it. Add a toolbar. Next search for the icons Face*.ico under the directory where you installed VB. Copy them to the location of your vb project and rename them like below.
Code:
'OVERALL:
'Button Press Down = Funny Face
'Button Not Press Down = Happy Face
'Button Disabled = Sad Face
Private Sub Form_Load()
'Attach a SAD face to imgDisable control
imgDisabled.ListImages.Add Key:="face", Picture:=LoadPicture(App.Path & "\Face Sad.ico")
'Attach a HAPPY face to imgNormal control
imgNormal.ListImages.Add Key:="face", Picture:=LoadPicture(App.Path & "\Face Happy.ico")
'Attach a FUNNY face to imgHot control
imgHot.ListImages.Add Key:="face", Picture:=LoadPicture(App.Path & "\Face Funny.ico")
With Toolbar1
'Bind the controls to the Toolbar1 properties
.ImageList = imgNormal
.DisabledImageList = imgDisabled
.HotImageList = imgHot
'Add the buttons to the toolbar
.Buttons.Add Caption:="Sad", Image:="face", Style:=tbrCheck
.Buttons.Add Caption:="Happy", Image:="face", Style:=tbrCheck
.Buttons.Add Caption:="Funny", Image:="face", Style:=tbrCheck
'Test the button by DISABLING it - if it is disable, it should be a sad face
.Buttons(1).Enabled = False
'Test the button by PRESSING it down - if it is pressdown, it should be a funny face
.Buttons(3).Value = tbrPressed
End With
End Sub
Chemically Formulated As:
Dr. Nitro
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
|