In this image processing tool software, there are more toolbars to implement. I want each toolbar to be floating without a close button, and you can also set the number of columns that the toolbar displays in the Toolbox toolbar. Based on the principles of class abstraction, we create a base class Cbasetoolbar for all toolbars, derived from CToolBar. The main features that Cbasetoolbar need to implement are: remove the close button when floating and set the number of columns in the toolbar.
Starting with Visual Studio.NET, including Visual C + + 2005, the Class Wizard features in Visual C + + 6.0 are removed. Some conceptual changes have taken place. Workspace that can contain multiple projects are replaced by solution, called a solution.
To add a new class to Visual C + + 2005, simply select the project in Solution Explorer, select the Add Class from the pop-up menu that you clicked on, and the wizard dialog box for the Add Class pops up. The following figure:
In the Class wizard dialog box that appears, select Add MFC Class, then click Add button, finally select CToolBar as base class, and derive class name to enter Cbasetoolbar. The wizard features in Visual C + + 2005 are more complete than Visual C + + 6.0 and have a richer selection of features. If you want to add CToolBar to the 6.0 version of the derived class can not directly select the CToolBar class, the general approach is to select the CToolBarCtrl, add the completed after the manual modification of the method to CToolBar, and now can directly choose CToolBar, save a lot of trouble.
To build a CToolBar derived class, let's look at how to implement the set of toolbar columns and remove the Close button. When setting the number of columns we add a function to the class: void setcolumns (int ncolumn); Adding a function to a particular class requires switching from Solution Explorer to Class View, where all classes are displayed. Select Add function or variable in the right key pop-up menu on the corresponding class name:
The Add Function dialog box is followed by a very rich feature, with direct mouse clicks can add virtual, static, inline, and other keywords to the function.