In-place tooltip

  • Thread starter Thread starter Sebastien Lange
  • Start date Start date
S

Sebastien Lange

Hi,

I'd like to implement In-place tooltip for some controls/area within my
application.
For example, listbox or treeview.
The following doc explains what it is, and almost how to do it:
http://msdn.microsoft.com/library/d...c/platform/commctls/tooltip/usingtooltips.asp

case TTN_SHOW:
if (fMyStringIsTruncated) {
RECT rc;

GetMyItemRect(&rc);
SendMessage(hwndToolTip, TTM_ADJUSTRECT, TRUE, (LPARAM)&rc);
SetWindowPos(hwndToolTip,
NULL,
rc.left, rc.top,
0, 0,
SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
}

But I don't know where to put this code? In the WndProc of the form
container, or the control itself?
I tried with both solutions, but nothing works. If I'm using Windows Forms
Tooltip component, how can I get the handle of the tooltip? Or maybe should
I create the tooltip myself?

Any C# sample (or VB.NET) is appreciated.

Thanks,
Sebastien
 
The TTN_SHOW notification is sent to the owner of the tooltip.
Unfortunately that is something that the built in tooltip control
doesn't provide you access to. I would suggest
you write your own tooltip control

If you're determined to use the built in control you might
have some luck by calling the GetParent function (a native
Win32 function) and then using the NativeWindow class
in .NET

/claes
 
Back
Top