3

I want to create a custom tooltip, with a different style so that when I click on a control (for example a label or a user-control) it appears.

Something similar to what Google does in Google Maps for coordinates.

I tried to create a user-control and show it when user clicked on a label, but it didn't work well.

It is WinForms!

I attached a picture of what I want. Thank you in advance!

Tooltip example

Dennis
  • 37,026
  • 10
  • 82
  • 150
Moslem Hadi
  • 846
  • 5
  • 18
  • 30
  • 1
    Why does this need to be a custom tooltip? You can make the standard one look like a balloon with an icon: [see this image randomly stolen from someone else online](http://i.stack.imgur.com/yTJEF.png). Using standard, built-in controls when possible is always a better idea than creating your own. Not only is it easier, but it means you'll introduce a lot fewer bugs and your app will look more like what the user expects to see. – Cody Gray - on strike Jul 25 '12 at 07:55
  • yes I know that! but First: I want the text in tooltip to be **Right-To-Left** , second I might wanna use Html in Instead of plain-Text!! – Moslem Hadi Jul 25 '12 at 08:01
  • If you use HTML, you can use the styling properties of the html to align your text :p – Yoeri Jul 25 '12 at 08:22

1 Answers1

6

Use a standard ToolTip but override the painting method so it can appear as you want it, while still behaving like a normal tool tip.

Haven't done this before so I can't provide an example.

EDIT: here is an example: http://cboard.cprogramming.com/csharp-programming/119414-custom-tooltip.html

Yoeri
  • 2,249
  • 18
  • 33
  • thank you. I've seen It before. what if I want the tool-tip to be **Right-To-left**? – Moslem Hadi Jul 25 '12 at 07:27
  • see: http://stackoverflow.com/questions/1796312/right-to-left-tooltip-text-c-sharp – Yoeri Jul 25 '12 at 07:31
  • in this solution http://stackoverflow.com/questions/1796312 in third answer by "PHeiberg", tooltip text-aling is set to right-to-left(but not in 'IsBalloon' mode!). I want a tooltip like my picture. – Moslem Hadi Jul 25 '12 at 07:57
  • i don't think 'IsBalloon' matters if you overwrite the draw method? Like I said, you should poke around with it a little. I'm sure it's possible. – Yoeri Jul 25 '12 at 08:21