将工具提示添加到CStatic

问题描述:

我无法找到简洁的代码块,无法使我向CStatic(和CLed)控件添加/显示工具提示.显然,这样做的标准代码不适用于这种类型的控件.有人可以发布代码段吗?

I haven't been able to find a concise chunk of code that allows me to add/display tooltips to a CStatic (and CLed) control. Obviously, the standard code to do so does not apply for this type of control. Can someone post code snippets?

我希望这段代码能解决您的问题.一件重要的事情是使CStatic = TRUE的NOTIFY属性.

I hope this code will solve your problem .One important thing make NOTIFY property of CStatic =TRUE.

if( !m_ToolTip.Create(this))
{
    TRACE0("Unable to create the ToolTip!");
}
else
{
    CWnd* pWnd = GetDlgItem(IDC_STATIC_MASTER_PWD);
    m_ToolTip.AddTool(pWnd,"Ok");
    m_ToolTip.Activate(TRUE);
}

让我知道是否有问题.