图标按钮
m_imageList.Create(32,32,ILC_COLOR24|ILC_MASK,1,1);
m_imageList.Add(AfxGetApp()->LoadIcon(IDR_MAINFRAME));
按钮ID
UINT array[2];
array[0] = ID_SYS_START;
m_toolbar.Create(this);
m_toolbar.SetButtons(array,2);
m_toolbar.SetButtonText(0,"开始");
m_toolbar.SetButtonStyle(1, TBBS_SEPARATOR);
按钮大小
m_toolbar.GetToolBarCtrl().SetButtonWidth(55,55);
m_toolbar.GetToolBarCtrl().SetImageList(&m_imageList);
m_toolbar.SetSizes(CSize(55,55),CSize(32,32));
m_toolbar.EnableToolTips(TRUE);
RepositionBars(AFX_IDW_CONTROLBAR_FIRST,AFX_IDW_CONTROLBAR_LAST,0);
tooltips
ON_NOTIFY_EX(TTN_NEEDTEXT, 0, OnToolTipNotify);
afx_msg BOOL OnToolTipNotify(UINT id, NMHDR *pNMHDR, LRESULT *pResult);
BOOL CFAS_CDlg::OnToolTipNotify(UINT id, NMHDR *pNMHDR, LRESULT *pResult)
{
BOOL bResult = TRUE;
TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR;
UINT nID =pNMHDR->idFrom;//获取发送消息的control的ID
//nID=m_toolbar.CommandToIndex(nID);
if (nID)
{
switch (nID)
{
case ID_SYS_START:
pTTT->lpszText = "开始";
break;
case ID_SYS_STOP:
pTTT->lpszText = "停止";
break;
}
}
return bResult;
}
{
BOOL bResult = TRUE;
TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR;
UINT nID =pNMHDR->idFrom;//获取发送消息的control的ID
//nID=m_toolbar.CommandToIndex(nID);
if (nID)
{
switch (nID)
{
case ID_SYS_START:
pTTT->lpszText = "开始";
break;
case ID_SYS_STOP:
pTTT->lpszText = "停止";
break;
}
}
return bResult;
}