Tuesday, December 11, 2007

How to create Toolbar

How to create Toolbar

Step 1

To create a toolbar in Visual Basic, user will need to create a MDI application and then create your menu as we describe above.

Step 2

Once we have got all that, we can create our toolbar, by using Toolbar control and picture box. Drag a component called Toolbar and place it just below your main menu. Then it will automatically scale to fit the menu. As shown in the diagram above.

Step 3

To create each Toolbar button, you need to use ImageList control

Step 4

You have to create an ImageList and then bind it your toolbar

Step 5

In your Window Form toolbar, create an ImageList Control.

Step 6

First we will create an Images for ImageList control.

Step 7

Click on Add to insert new images to this control. We will use some sample images for our demo here.

An example of our output here had shown above.

Step 8

Then we will proceed to setup our toolbar in VB.net. Switch to our Toolbar and then under its imageList set the properties to ImageList1 control that we have created earlier.

Step 9

Okay, then we will set it’s Button properties. Under your toolbar properties select Button and then click on to open a window.

Step 10

Click on Add to add a toolbar. Under the ImageIndex, set it to an Imagelist that you have created. In this example we will create 2 of this toolbar.

If you would like to set your Tooltip you can do so here.

This is an example of your Toolbar.

Step 11

Then just press F5 and run it. Off course there will be no function to run as you did not put it in.

No comments: