win32 创建带图片的button
void ClientConnection::CreateButtons()
{
int nr_buttons = 14;
TBADDBITMAP tbab;
TBBUTTON tbButtons []=
{
{0,ID_BUTTON_CAD,TBSTATE_ENABLED,TBSTYLE_BUTTON,0L,0},
{1,ID_BUTTON_FULLSCREEN,TBSTATE_ENABLED,TBSTYLE_BUTTON,0L,1},
{2,ID_BUTTON_PROPERTIES,TBSTATE_ENABLED,TBSTYLE_BUTTON,0L,2},
{3,ID_BUTTON_REFRESH,TBSTATE_ENABLED,TBSTYLE_BUTTON,0L,3},
{4,ID_BUTTON_STRG_ESC,TBSTATE_ENABLED,TBSTYLE_BUTTON,0L,4},
{5,ID_BUTTON_SEP,TBSTATE_ENABLED,TBSTYLE_BUTTON,0L,5},
{6,ID_BUTTON_INFO,TBSTATE_ENABLED,TBSTYLE_BUTTON,0L,6},
{7,ID_BUTTON_END,TBSTATE_ENABLED,TBSTYLE_BUTTON,0L,7},
{8,ID_BUTTON_DBUTTON,TBSTATE_ENABLED,TBSTYLE_BUTTON,0L,8},
{9,ID_BUTTON_DINPUT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0L,9},
{10,ID_BUTTON_FTRANS,TBSTATE_ENABLED,TBSTYLE_BUTTON,0L,10},
{11,ID_BUTTON_SW,TBSTATE_ENABLED,TBSTYLE_BUTTON,0L,11},
{12,ID_BUTTON_DESKTOP,TBSTATE_ENABLED,TBSTYLE_BUTTON,0L,12},
{13,ID_BUTTON_TEXTCHAT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0L,13},
};
static char *szTips[14] =
{
sz_L2,
sz_L3,
sz_L4,
sz_L5,
sz_L6,
sz_L7,
sz_L8,
sz_L9,
sz_L10,
sz_L11,
sz_L12,
sz_L13,
sz_L14,
sz_L15,
};
int stdidx;
HWND m_hwndTT;
UINT buttonmap,minibuttonmap;
int row,col;
TOOLINFO ti;
int id=0;
RECT clr;
InitCommonControls();
GetClientRect(m_hwndMain,&clr);
m_TBr.left=0;
m_TBr.right=clr.right;
m_TBr.top=0;
m_TBr.bottom=28;
buttonmap=IDB_BITMAPl;
minibuttonmap=IDB_BITMAPs;
m_hwndTB = CreateToolbarEx(m_hwndTBwin//,WS_CHILD|WS_BORDER|WS_VISIBLE|TBSTYLE_TOOLTIPS|TBSTYLE_WRAPABLE|TB_AUTOSIZE
,WS_CHILD | TBSTYLE_WRAPABLE | WS_VISIBLE |TBSTYLE_TOOLTIPS |CCS_NORESIZE | TBSTYLE_FLAT | TBSTYLE_TRANSPARENT
,IDR_TOOLBAR
,nr_buttons
,(HINSTANCE)m_pApp->m_instance
,buttonmap
,(LPCTBBUTTON)&tbButtons
,nr_buttons
,20
,20
,20
,20
,sizeof(TBBUTTON));
}
IDB_BITMAPl BITMAP "Tango_l.bmp"