Tooltip on usercontrol

Joined
May 23, 2003
Messages
11
Hi there!

Im writing a usercontrol wich contains multiple buttons which I draw usering GDI+.
It arent actually buttons (controls) but i just draw them.
Now i want to show a tooltip if the mouse moves over a button.
I tried to do this on the mousemove event:

Protected Overrides Sub OnMouseMove(ByVal e As system.Windows.Forms.MouseEventArgs)

Dim MyButton As OutlookBarButton
Me.MyTooltip.RemoveAll()
For Each Button In Me.buttons
If MyButton.Bounds.Contains(e.x, e.y) Then
Me.MyTooltip.SetToolTip(Me, MyButton.Title)
End If
Next
End sub

But this wont work.
The control doesnt show a tooltip at all.
How should I do this?!
Please understand that MyButton is NOT a control, but just a class.
So Me.mytooltip.SetToolTip(MyButton, MyButton.title) is not possible!

I hope someone can help me out!

Erik
 
There is no .NET tooltip wrapper for implementing regional tooltips for a control. When I had to implement them in my toolbar control I had to use the win32 api tooltips through platform invoke, there is a fair amount of information in msdn on getting them working.

If you get stuck, post in this thread and Ill help.
 
Dear Divil,

I dont know even where to start...
How do I implement the Win32 api tooltip???
Can you give me a simple example to get me started.
Thanks so far...

Erik
 
Im afraid there is no simple example, if I have time Ill try to knock up a sample for you. Youll have to be familiar with Platform Invoke and do some reading of MSDN on the various messages you send to establish a tooltip window and configure regions.
 
Hi Divil,

Ill take al look on MSDN to find some information.
Thanks so far!
If you have a example or a URL for me. Please post it here.

Erik
 
Ive posted a sample for you in the code library, it should be more than enough to get you started.
 
Back
Top