15,979
社区成员
发帖
与我相关
我的任务
分享
m_toolTipCtrl.Create(this, TTS_BALLOON | TTS_ALWAYSTIP | TTS_CLOSE | TTS_NOFADE);
m_toolTipCtrl.SetMaxTipWidth(600);
m_toolTipCtrl.SetDelayTime(2000);
m_toolTipCtrl.AddTool(this, _T("测试\r\n你好"));
m_toolTipCtrl.Activate(TRUE);
BOOL CSDItooltipView::OnToolTipText( UINT id, NMHDR * pNMHDR, LRESULT * pResult )
{
// need to handle both ANSI and UNICODE versions of the message
static BOOL first=TRUE;
if(first)
{
first=FALSE;
_AFX_THREAD_STATE* pThreadState = AfxGetThreadState();
CToolTipCtrl* pToolTip = pThreadState->m_pToolTip;
if(pToolTip)
{
pToolTip->SetTipBkColor(RGB(0,0,255));// blue
pToolTip->SetTipTextColor(RGB(255,255,255));//white
pToolTip->SendMessage(TTM_SETMAXTIPWIDTH,0,SHRT_MAX);// 32767
}
}
TOOLTIPTEXTA* pTTT = (TOOLTIPTEXT*)pNMHDR;
CString strTipText;
UINT nID = pNMHDR->idFrom;
strTipText.Format("Work A\r\nID=%d",nID);
//
lstrcpyn(pTTT->szText, strTipText, 80);
*pResult = 0;
//
return TRUE;
}