How to change the ToolTip location?




I have written a Custom Control which inherits from ToolTip and it is an
OwnerDraw tooltip.

In the Popup event I calculate the size of the tooltip I need to display
(rather large tooltip) and resize it using the ToolTipSize property.

In the Draw event, I draw my tooltip.

All that works well, but when I hover over a control associated with my
tooltip, if the control is closer to the right edge of the screen than my
tooltip is wide, my tooltip gets parly displayed off the screen.

I have 2 questions:

1. isn't a tooltip normally supposed to auto-adapt its position so that it
always stays entirely visible, even if the control which displays it is
close to a screen edge?

2. is there a way I can programmatically change the tooltip location (after
the Popup event fired and just before its gets displayed)?

It looks like C# computes the tooltip location BEFORE I change the tooltip
size in the Popup event and does NOT adapt the tooltip location when I
change its size in the Popup event!

Thanks for help!



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