15,979
社区成员
发帖
与我相关
我的任务
分享
void CTankControl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{……}
int CTankControl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CButton::OnCreate(lpCreateStruct) == -1)
return -1;
EnableToolTips();
m_ttcTips.Create(this, TTS_ALWAYSTIP);
m_ttcTips.Activate(TRUE);
m_ttcTips.AddTool(this, "Tank Control");
return 0;
}
BOOL CTankControl::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message== WM_LBUTTONDOWN ||
pMsg->message== WM_LBUTTONUP ||
pMsg->message== WM_MOUSEMOVE)
{
m_ttcTips.RelayEvent(pMsg);
}
return CButton::PreTranslateMessage(pMsg);
}
BOOL CTankControl::SetTipText(UINT nID, NMHDR *pTTTStruct, LRESULT *pResult)
{
TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pTTTStruct;
UINT nForm = pTTTStruct->idFrom;
if (pTTT->uFlags & TTF_IDISHWND)
{
nForm = ::GetDlgCtrlID((HWND)nForm);
if (nForm)
{
strcpy(pTTT->lpszText, "Test");
return TRUE;
}
}
return FALSE;
}