Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Visual C++ and MFC Fundamentals Chapter 3: Windows Resources



  1. Close the window and return to MSVC


3.4 Toolbars.............................................................................................................


3.4.1 Overview..................................................................................................


A toolbar is a Windows control that allows the user to perform some actions on a form by
clicking a button instead of using a menu. A toolbar provides a convenient group of
buttons that simplifies the user's job by bringing the most accessible actions as buttons so
that, instead of performing various steps to access a menu, a button on a toolbar can bring
such common actions closer to the user.

Toolbars usually display under the main menu. They can be equipped with buttons but
sometimes their buttons or some of their buttons have a caption. Toolbars can also be
equipped with other types of controls

3.4.2 Creating a Toolbar..................................................................................


To create a toolbar, from the Add Resource dialog box, click Toolbar and click New.

A toolbar is only a container and does not provide much role by itself. To make a toolbar
efficient, you should equip it with the necessary controls.

The most common control used on a toolbar is a button. After adding a new toolbar, it is
equipped with a gray button. You can simply start designing that button as you see fit.
Once you start designing a button, a new one is added. You can keep designing the
buttons until you get as many buttons as you need. If you design a button but do not need
it anymore, to delete it, drag it away from the toolbar. The space between two buttons is
called a separator. To put a separator between two buttons, drag one away from the other
just a little.

3.5 Accelerators......................................................................................................

Free download pdf