Results 1 to 7 of 7

Thread: Toolbar

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    247
    Will someone show me how to make a toolbar. I don't know where to start. How to add the icons?

    Thanks
    Mako Shark
    Great White

  2. #2
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516
    Do you mean making one from scratch or using the Common Controls OCX?
    Courgettes.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    247
    I mean like when you run the wizard and the toolbar that automatically comes with the program.
    Mako Shark
    Great White

  4. #4
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516
    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!
    Courgettes.

  5. #5
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    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!

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    247
    Under the toolbar properties, what is "Disabledimagelist", "Hotimagelist", "Button menus" and "description"?
    Mako Shark
    Great White

  7. #7
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    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
  •  



Click Here to Expand Forum to Full Width