In-place tooltip

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
 
C

Claes Bergefall

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top