DWORD dwCtrlStyle = TBSTYLE_FLAT|TBSTYLE_TRANSPARENT;TBSTYLE_TRANSPARENT Version 4.71. Creates a transparent toolbar. In a transparent toolbar, the toolbar is transparent but the buttons are not. Button text appears under button bitmaps. To prevent repainting problems, this style should be set before the toolbar control becomes visible.看看是不是这个属性的问题~
Construct the CToolBar object. Call the Create (or CreateEx) function to create the Windows toolbar and attach it to the CToolBar object. Call LoadBitmap to load the bitmap that contains the toolbar button images. Call SetButtons to set the button style and associate each button with an image in the bitmap. 是不是没有LoadBitmap?
DWORD dwStyle = WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_FLYBY|CBRS_SIZE_DYNAMIC;
CRect rc(0, 20, 300, 80);
BOOL b = m_Bar.CreateEx( this, dwCtrlStyle, dwStyle, rc, 1025 );
b = m_Bar.SetButtons(NULL, 5); for(int i=0; i<5; i++)
{
m_Bar.SetSizes(CSize(50, 50), CSize(40, 40));
UINT id = m_Bar.GetItemID(i);
m_Bar.SetButtonInfo(i, id, TBBS_BUTTON, NULL);
b = m_Bar.SetButtonText(i, "asdf");
}
m_Bar.ShowWindow(SW_SHOW);
Version 4.71. Creates a transparent toolbar. In a transparent toolbar, the toolbar is transparent but the buttons are not. Button text appears under button bitmaps. To prevent repainting problems, this style should be set before the toolbar control becomes visible.看看是不是这个属性的问题~
CRect rc(0, 20, 300, 80);
// BOOL b = m_Bar.CreateEx( this, dwCtrlStyle, dwStyle, rc, 1025 );
m_Bar.Create(this);
m_Bar.MoveWindow(rc);就OK了至于CreateEx()个函数 如何如何 下去再论!开忙了 谢谢楼上各位了
Call the Create (or CreateEx) function to create the Windows toolbar and attach it to the CToolBar object.
Call LoadBitmap to load the bitmap that contains the toolbar button images.
Call SetButtons to set the button style and associate each button with an image in the bitmap. 是不是没有LoadBitmap?