Sometimes we need to put multi-row buttons in a toolbar, such as the drawing software that comes with Windows, how to implement it? There is a small skill here, I hope you can like :)
First, we assume that our toolbar resource number is idR_painttool; we have a CPAINTTOOLBAR class from the CToolbar class, add a protected member variable: protected: uin m_ncolumns; file: // Row m_ncolumns line public: void setColumns (uint ncolumn); The number of lines // UINT GetColumns () {return m_nColumns;} // get the number of rows to start adding the following functions: void CPaintToolbar :: SetColumns (UINT nColumns) {m_nColumns = nColums; int nCount = GetToolBarCtrl () getButtonCount (); for. (INT i = 0; i recalclayout ();} Ok, everything is as simple as.