There are many ways to use VC production toolbars, which provide a tool bar similar to IE4.0. When the mouse movement can be implemented, the icon changes to color, and several tools can be stopped at the position of the toolbar. Specific principles explain the step process. The steps are as follows: 1. Run AppWizard, select Single Document, and the rest of the settings.
2. Click Insert Resource to join two Bitmap, defined as: IDB_Coldtoolbar and IDB_Hottoolbar3. Add member variables in CMAINFRAME: Crebar M_Wndrebar; CCOMBOBOXEX M_WNDDRESS; 4. Modify CMainFrame :: OnCreate (LPCREATESTRUCT lpCreateStruct) function is as follows: int CMainFrame :: OnCreate (LPCREATESTRUCT lpCreateStruct) {CImageList img; CString str; if (CFrameWnd :: OnCreate (lpCreateStruct) == -1) return -1; if (m_wndToolBar! ! .CreateEx (this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC)) {TRACE0 ( "Failed to create toolbar"); return -1; // fail to create} if (m_wndStatusBar.Create ( This) ||! m_wndstatusbar.setindicators (INDICATORS, SIZEOF (INDCATORS) / SIZEOF (TRACE0 ("Failed to Create Status Bar"); Return -1; // Fail to Create} m_wndtoolbar.gettoolbarCtrl (). SetButtonWidth (50, 150); // Setting the toolbar button size m_wndtoolbar.gettoolbarctrl (). SetExtendedStyle (TBSTYLE_EX_DRAWDDARROWS); // Creating a mouse to the icon list IMG.CREATE (IDB_HOTTOOLBAR, 22, 0, RGB (255, 0 , 255); m_wndtoolbar.gettoolbarctrl (). Sethotimagelist (& img); img.detach (); // Create Focus Point icon list img.Create (IDB_COLDTOOLBAR, 22, 0, RGB (255, 0, 255)); m_wndToolBar.GetToolBarCtrl () SetImageList (& img); img.Detach ();. M_wndToolBar.ModifyStyle (0, TBSTYLE_FLAT | TBSTYLE_TRANSPARENT ); // Set the number of icons to display, modify m_wndtool bar.setButtons (NULL, 9) according to the actual situation; // Set the icon button one by one / * setButtonInfo ((int NSTONDEX, UINT NID, UINT NSTYLE, IIMAGE) The parameter is as follows: NINDEX: The index value of the icon button NID: Icon button is associated with the resource number NStyle: The style of the icon button is commonly used as follows:
TBBS_BUTTON standard button TBBS_SEPARATOR separator TBSTYLE_DROPDOWN iImage with the arrow buttons: ImageList pattern in association establishment index * / m_wndToolBar.SetButtonInfo (0, ID_FILE_NEW, TBSTYLE_BUTTON, 0); m_wndToolBar.SetButtonText (0, "back") ; m_wndToolBar.SetButtonInfo (1, ID_FILE_OPEN, TBSTYLE_BUTTON, 1); m_wndToolBar.SetButtonText (1, "forward"); m_wndToolBar.SetButtonInfo (2, ID_FILE_SAVE, TBSTYLE_BUTTON|TBBS_SEPARATOR, 2); m_wndToolBar.SetButtonText (2, "stop") ; m_wndToolBar.SetButtonInfo (3, ID_FILE_PRINT_SETUP, TBSTYLE_BUTTON | TBSTYLE_DROPDOWN, 3); m_wndToolBar.SetButtonText (3, "Print settings"); CRect rectToolBar; // set the toolbar size m_wndToolBar.GetItemRect (0, & rectToolBar); m_wndToolBar.SetSizes ( RectToolBar.Size (), CSIZE (30, 20)); // Create if (! m_wndaddress.create (CBS_DropDown | WS_CHILD, CRECT (0, 0, 200, 120), this, AFX_IDW_TOOLBAR 1) {trace0 (" Failed to create comboBox "); return -1; // fail to create} comboBOXITEM ITEM; item.mask = cbeif_text; item.iitem = -1; Item.psztext = "Laster Thought"; M_Wndaddress.Isertitem (& Item); if (! M_WndreBar.create (this)) {trace0 ("failed to create rebar"; return -1; // fail to create} // Add the toolbar and the generated input box to the Crebar object, centrally display the toolbar area m_wndrebar.addbar (& m_wndtoolbar); m_wndrebar.addbar (& M_Wndaddress, "Address", NULL, RBBS_FIXEDBMP | RBS_BREAK); RETURN 0;} to this, run The program is already possible to see a program similar to IE4.0. However, the drop-down icon button does not display the drop-down menu, and no message response is for the input box.