VB6 beginners tutorial - Learn VB6

Advanced VB6 tutorial - Learn Advanced VB6

Systems Analysis - System analysis and Design tutorial for Software Engineering

You are here: Visual Basic > Advanced VB6 tutorial > Chapter 4

VB ToolBar - ToolBar Control in Visual Basic 6 (VB6)

In earlier 16-bit releases of Visual Basic, it was difficult to implement a toolbar for your users. You had to place a PictureBox control on a form and then add CommandButton controls to the PictureBox to simulate the toolbar. Starting with the 32-bit version of Visual Basic 4.0 and continuing with all subsequent versions of VB, you have the ToolBar ActiveX control that you can add to your forms to easily implement toolbar functionality for your users.

A toolbar is becoming a standard feature of Windows applications. Toolbars provide functionality to a user through an easily accessible, graphical interface. For common functions the user does not need to navigate through a menu or remember shortcut keys to use an application. Applications can expose their most common features through buttons on a toolbar.

Setting Custom Properties

The ToolBar control is available through the Windows Common Controls, along with the TreeView, ListView, and ImageList . After you have drawn a toolbar on a form, you will usually start by setting properties through the Property Pages dialog box for the control.

On the first tab of the Property Pages dialog box, as shown in Figure 4.9, one of the options you will set most often is the ImageList . Like the TreeView and the ListView controls, the toolbar gets images from an ImageList control. If you are building a toolbar that will have graphics on its buttons, you will first need to add an ImageList control to the form and then bind that ImageList to the toolbar through the Property Pages dialog box.

General tab of the Custom Properties of a toolbar.
FIGURE 4.9 General tab of the Custom Properties of a toolbar.

Several other properties are unique to the toolbar and can be set on the General tab. The ButtonHeight and ButtonWidth properties determine the size of buttons that appear on the toolbar. All buttons will have the same height and width. The number of buttons that can appear on a toolbar is determined by the size of the buttons and the width of the window. If you want the toolbar and buttons to wrap when the window is resized, you can set the Wrappable property of the toolbar to True.

If you want to add ToolTips to your ToolBar control, you must set the ShowTips property to True. The actual tips that appear are tied to each button. You can allow the user to customize the toolbar by setting the AllowCustomize button to True. These properties are discussed later in the section "Customizing Toolbars."

ToolBar Control topics

See Also


<< Previous | Contents | Next >>

Home | About Us | Privacy Policy | Contact Us

Copyright © | All Rights Reserved