CMFCToolTipCtrl 是个很有用的控件,在MSDN上
CMFCToolTipCtrl Class有比较详细的介绍,但还是不全,这里完整记录下这个控件使用方法。
0.平台
VS2010 + win8.1
对话框程序
1..h中声明
CMFCToolTipCtrl m_ToolTips;
2..cpp中的OnInitDialog函数
CMFCToolTipInfo params;
params.m_bVislManagerTheme = TRUE;
params.m_bBoldLabel = FALSE;
params.m_bDrawDescription = FALSE;
params.m_bDrawIcon = FALSE;
params.m_bRoundedCorners = TRUE;
params.m_bDrawSeparator = FALSE;
params.m_clrFill = RGB (255, 255, 255);
params.m_clrFillGradient = RGB (228, 228, 240);
params.m_clrText = RGB (61, 83, 80);
params.m_clrBorder = RGB (144, 149, 168);
m_ToolTips.SetParams (¶ms);
// TODO: Use one of the following forms to add controls:
m_ToolTips.AddTool (GetDlgItem(IDC_PASSWORDEDIt), _T("初始密码:123456"));
3.对话框添加PreTranslateMessage事件
switch (pMsg->message)
{
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
case WM_MBUTTONDOWN:
case WM_LBUTTONUP:
case WM_RBUTTONUP:
case WM_MBUTTONUP:
case WM_MOUSEMOVE:
m_ToolTips.RelayEvent(pMsg);
break;
}