ctoolbar, ctoolbarctrl, and cstatusbar and cstatusbarctrl are inherited from the cwnd class.
Both ctoolbar and cstatusbar are encapsulated in the control bars class, while both cstatusbarctrl and ctoolbarctrl are in the controls class.
.
Ctoolbarctrl and cstatusbar do not provide more functions than the API version because they only encapsulate APIs and do not add additional functions.
They cannot be moved or docked by users or vertically aligned. They can only be used to set and control buttons and panes more easily within the control bar. Therefore, to obtain desired functions, you must create your own control bar.
This requires two other MFC classes: ctoolbar and cstatusbar.
Using ctoolbar to create a toolbar is easy, and you do not need to consider the rect parameter.
However, the greatest convenience lies in the loading of Bitmap and definition buttons:
Ctoolbar TB; TB. loadtoolbar (uint ID );
In this case, you do not need to define the bitmap and each button programmatically. You can use the toolbar editor to create a resource to be referenced.
Using these classes, loadtoolbar not only makes it easier to load and configure control bars, but also provides the following enhanced functions:
Using the ctoolbar class, the color of the bitmap used in the toolbar automatically changes with the color of the current button.
light gray is a standard Windows button surface color. However, if you are sure to select a new color scheme for your desktop (for example, , such as lavender ), if the toolbar remains light gray, the button seems to have deviated from its original position. Therefore, ctoolbar converts them into the current button color.
According to the inheritance idea of C ++, The ctoolbar and cstausbar classes are derived from ctoolbarctrl and cstatusbarctrl, so they can inherit the functions of both.