次の方法で共有


Creating a CToolBarCtrl Object

OverviewSample

objects contain several internal data structures — a list of button image bitmaps, a list of button label stings, and a list of TBBUTTON structures — that associate an image and/or string with the position, style, state, and command ID of the button. Each of the elements of these data structures is referred to by a zero-based index. Before you can use a CToolBarCtrl object, you must set up these data structures. For a list of the data structures, see in the Platform SDK. The list of strings can only be used for button labels; you cannot retrieve strings from the toolbar.

To use a CToolBarCtrl object, you will typically follow these steps:

To use a CToolBarCtrl object

  1. Construct the object.

  2. Call to create the Windows toolbar common control and attach it to the CToolBarCtrl object. If you want bitmap images for buttons, add the button bitmaps to the toolbar by calling . If you want string labels for buttons, add the strings to the toolbar by calling and/or .

  3. Add button structures to the toolbar by calling .

  4. If you want tool tips, handle TTN_NEEDTEXT messages in the toolbar's owner window as described in in the Class Library Reference.

  5. If you want your user to be able to customize the toolbar, handle customization notification messages in the owner window as described in in the Class Library Reference.

See Also   Windows Common Controls and MFC Classes