我怎么设CToolBarCtrl的Style 和 TBBUTTON的Style 都不行啊?
请高手帮忙了...
请高手帮忙了...
解决方案 »
- vc6跟vs2008 还是 xp跟vista的问题?
- 那位大侠能指导一下win32下用hwnd方式创建第三方程序的扩充菜单,谢谢?
- SetFieldValue…………
- 请问.chm帮助文件的运行异常
- 怎样让程序退出后重新启动?
- strip(阿飞) : 非常感谢,20分略表心意
- windows XP 系统调色板只有256项吗?如果是怎么显示大于256种的颜色?
- 多线程非阻塞客户端ssh连接server后创建的线程总是connect失败
- 为什么用得到的图标放到CIMAGELIST里有黑边
- CSocket问题, sockcore.cpp line 177 是什么错误? 44分
- 如何在程序中检测到计算机休眠?(在线等,焦急)
- 在线等待,急急急(BCG)
CToolBarCtrl::GetToolTips ()
否则要自己加CToolTipCtrl
1、首先用ON_NOTIFY_EX_RANGE宏绑定消息处理函数,这个宏的含义可以参考
MSDN上的说明
BEGIN_MESSAGE_MAP(CMyDialog, CDialog)
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnTooltips)
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnTooltips)
END_MESSAGE_MAP()
2、然后在消息处理函数中写代码
void CMyDialog::OnTooltips(UINT nID, NMHDR * pNotifyStruct, LRESULT * lResult)
{
CString strToolTip = NeedText(nID, pNotifyStruct, lResult);
LPTOOLTIPTEXTW lpTTTW = (LPTOOLTIPTEXTW)pNotifyStruct;
LPTOOLTIPTEXTA lpTTTA = (LPTOOLTIPTEXTA)pNotifyStruct;#ifndef _UNICODE
if (pNotifyStruct->code == TTN_NEEDTEXTA)
lstrcpyn(lpTTTA->szText, strToolTip, strToolTip.GetLength() + 1);
else
_mbstowcsz(lpTTTW->szText, strToolTip, strToolTip.GetLength() + 1);
#else
if (pNotifyStruct->code == TTN_NEEDTEXTA)
_wcstombsz(lpTTTA->szText, strToolTip, strToolTip.GetLength() + 1);
else
lstrcpyn(lpTTTW->szText, strToolTip, strToolTip.GetLength() + 1);
#endif
}CString CReportPreviewDlg::NeedText(UINT nID, NMHDR * pNotifyStruct, LRESULT * lResult )
{
LPTOOLTIPTEXT lpTTT = (LPTOOLTIPTEXT)pNotifyStruct ;
CString strToolTip;
//ID_MOVEFIRST_BTN到ID_GRIDPROP_BTN是ToolBar上的一堆连续的按钮的资源
//ID,因为ON_NOTIFY_EX_RANGE宏是绑定一堆连续的窗口ID的。
if ((lpTTT->hdr.idFrom < ID_MOVEFIRST_BTN) || (lpTTT->hdr.idFrom > ID_GRIDPROP_BTN))
{
strToolTip="";
}
else
{
strToolTip.LoadString(lpTTT->hdr.idFrom);
// szText length is 80
int nLength = (strToolTip.GetLength() > 79) ? 79 : strToolTip.GetLength();
strToolTip = strToolTip.Left(nLength);
}
return strToolTip;
}3、以上代码是经验证有效。
:) 能不能简单一点
CToolBarCtrl *wndVToolBar;
wndVToolBar=&(m_wndBar.GetToolBarCtrl());
m_tips=(wndVToolBar->GetToolTips());
m_tips->AddTool()
m_tips->Activate(true);
可是还是出不来ToolTip(前提:我去掉了m_wndBar的CBRS_TOOLTIPS属性。)//
2.自己加上CToolTipCtrl可是无法addtool????
if (m_tips->Create(this))
{
CWnd* pW=GetDlgItem(ID_TOOLBAR_ITEM1);//得到窗口指针
ASSERT(pW!=NULL);
m_tips.AddTool(pW,"1111111111");
}请执教