tooltips定位显示的问题
我在对话框中,为一个显示图片的static控件(其实就是一个label)
添加了tooltips提示,现在tooltips能正常显示出来,但是这个提示窗口
总是显示在鼠标的尾部下方。我现在需要让这个提示小窗口显示在我这个静态
控件的上方,该怎么解决?有人说用setToolRect(),我用过了,但是还是不起作用。
请大家帮忙,非常紧急!
我的code 如下:
BOOL CTryLabelDlg::OnInitDialog()
{
CDialog::OnInitDialog();
...........
// TODO: Add extra initialization here
CBitmap bmp;
bmp.LoadBitmap(IDB_YELLOW);
this->m_label.ModifyStyle(0, SS_BITMAP);
m_label.SetBitmap(bmp);
bmp.Detach();
m_tooltip.Create(this,TTS_ALWAYSTIP);
CToolInfo toolinfo;
RECT rc1;
m_label.GetClientRect(&rc1);
m_tooltip.AddTool(&m_label, _T("Help"), &rc1, IDC_LABEL);
RECT rc;
rc.left = 0;
rc.bottom= 30;
rc.top= 0;
rc.right = 100;
m_tooltip.SetToolRect(&m_label, 1, &rc);
m_tooltip.Activate(true);
return TRUE; // return TRUE unless you set the focus to a control
}
BOOL CTryLabelDlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(m_tooltip.GetSafeHwnd() != NULL)
{
m_tooltip.RelayEvent(pMsg);
}
return CDialog::PreTranslateMessage(pMsg);
}