Toolbar Button Size 
Author Message
 Toolbar Button Size

What is the syntax for changing a toolbars button size?
I have tried "toolbar1.buttonsize.height = 24" but that
does't work.

Sun, 05 Sep 2004 23:43:44 GMT  
 Toolbar Button Size
The button size is dependant on the text, the font, and the image. A toolbar
button's height and width are not changeable through code.


Randy Birch
MVP Visual Basic

Please respond only to the newsgroups so all can benefit.

*** If you call the Sleep API in Bill's latest, will it have .NET dreams?

> What is the syntax for changing a toolbars button size?
> I have tried "toolbar1.buttonsize.height = 24" but that
> does't work.

Mon, 06 Sep 2004 12:21:38 GMT  
 Toolbar Button Size
Hi Bob,

You can easily resize the buttons by changing the ImageList associated with
the Toolbar.

Let's say, for example, that I want to have the option of showing large
buttons or small buttons.  The large buttons are 32x32 in size and the
small buttons are 16x16.  Here's how you would accomplish that:

1)  Add two ImageList controls to your form.
2)  Add the 32x32 images to the first ImageList control.
3)  Add the 16x16 images to the second ImageList control.

In your code, when you want to change the size of the buttons, you simply
change the ImageList that is associated with the Toolbar control.  Here is
an example using an Option button called optButtonSize to change the

Private Sub optButtonSize_Click(Index As Integer)
   Dim button As Button

   Select Case Index
        Case 0     ' option button to change to large buttons...
            Toolbar1.ImageList = ImageList1
        Case 1     ' option button to change to small buttons...
            Toolbar1.ImageList = ImageList2
    End Select

    ' reset the Image property for each toolbar button...
    For Each button in Toolbar1.Buttons
       button.Image = button.Index
    Next button

End Sub

In this example, you will notice that I have explicitly reset the Image
index for each button.  If you don't do this, the image will not display.  

Also note that if you have a DisabledImageList and/or a HotImageList, they
must all be set so that they contain the same sized images.  You cannot
have different sized images in different ImageList controls that are
assigned to the Toolbar.

I hope that helps.

Jim Cheshire
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. ? 2002 Microsoft Corporation. All rights

| Content-Class: urn:content-classes:message

| Subject: Toolbar Button Size
| Date: Wed, 20 Mar 2002 07:43:44 -0800
| Lines: 3

| MIME-Version: 1.0
| Content-Type: text/plain;
|       charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Thread-Index: AcHQJgQwnQclH6xKTea2QJUilLQPVA==
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
| Newsgroups: microsoft.public.vb.controls
| NNTP-Posting-Host: TKMSFTNGXA07
| Path: cpmsftngxa08!cpmsftngxa07
| Xref: cpmsftngxa08 microsoft.public.vb.controls:127773
| X-Tomcat-NG: microsoft.public.vb.controls
| What is the syntax for changing a toolbars button size?
| I have tried "toolbar1.buttonsize.height = 24" but that
| does't work.

Mon, 06 Sep 2004 23:04:26 GMT  
 [ 3 post ] 

 Relevant Pages 

1. Toolbar Button Sizing - Help!

2. Toolbar Button Size

3. Font Size macro toolbar buttons...

4. Font Size macro toolbar buttons...

5. Clipped Toolbar Buttons When Setting Form Size

6. need help with button size in toolbar control

7. BUG: Toolbar-Buttons wrong pictures - (1/1)

8. BUG: Toolbar-Buttons wrong pictures - (0/1)

9. Changing Toolbar Button Properties Outside of the Toolbar

10. BUG: Toolbar-Buttons 32*32 wrong pricture - (0/1)

11. BUG: Toolbar-Buttons 32*32 wrong pricture - (1/1)

12. Open a custom form with a module-button (not a toolbar button)


Powered by phpBB® Forum Software