Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Coolbars, toolbars, and imagelists with disabled icons

Status
Not open for further replies.

Ekliptic

Programmer
Dec 12, 2000
23
0
0
CA
From what I understand in creating a coolbar you add a toolbar with an imagelist connected to the toolbar. I want to be able to disable an icon when the situation calls for it but I can't find code or a way to do this anywhere. Do I add another imagelist in the Disabled Imagelist option in the toolbar? If so do I add icons that look like their disabled or does vb do this automatically through the .enabled = false property? I'm seriously confused about this. Could someone explain this to me.

Thanks in advance for your help.

tschock
 
Try this:

1. Add a toolbar named ToolBar1 to a form.
2. Add an image list named ImageList1 to the form, and add some images.
3. Right click on the toolbar and select Properties.
4. Set the ImageList property to ImageList1.
5. Add some buttons to the toolbar, setting the Image property of each button (from 1 onwards)
6. Add a button named Command1 to the form.
7. Add this code to the form module:

Private Sub Command1_Click()

Toolbar1.Buttons(1).Enabled = Not Toolbar1.Buttons(1).Enabled

End Sub


8. Run the program and repeatedly click the button.

You should see the first button alternately disable and enable.
The toolbar takes care of the disabled picture so you do not need to worry about it.

Simon
 
Thank you! Just the answer I was looking for.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top