4

I'm trying to get a notification to pop up something like these bubbles in an MFC application:

unused icons bubble image

caps lock still on image
(source: humanized.com)

I'm currently making an interface mockup in C# to show some stakeholders, so it would be nice to have it there too.

It doesn't necessarily have to be speech-bubble-esque: it could be something like a tooltip - but it does have to appear without mouse-over

Cheers!

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Smashery
  • 57,848
  • 30
  • 97
  • 128

4 Answers4

6

Just found this on CodeProject. Downloaded the sample and it works well actually. I'm going to add this to my own code repository; never know when I may need this!

BFree
  • 102,548
  • 21
  • 159
  • 201
3

Have a look on CodeProject (C#) :)

leppie
  • 115,091
  • 17
  • 196
  • 297
3

It's a standard windows mechanism (since XP), they're called Balloon Tooltips. Depending on where you want to display the balloon, you can use CEdit's ShowBalloonTip method or Shell_NotifyIcon API.

There's NotifyIcon class in Windows Forms, but I don't know about TextBox, you would probably have to use interop.

macbirdie
  • 16,086
  • 6
  • 47
  • 54
  • This doesn't seem to work - could that be because I'm under VS2005? – Smashery Mar 01 '09 at 23:29
  • Yes, probably, CEdit's ShowBalloonTip might have been introduced in VS2008. You can use CEdit's HWND and do it in pure API. There's a Edit_ShowBalloonTip macro. – macbirdie Mar 02 '09 at 07:32
2

You could just use System.Windows.Forms.ToolTip.

using System.Windows.Forms;

...

ToolTip myTip = new ToolTip; // create tooltip
myTip.IsBaloon = true; // give it a round shape
myTip.SetToolTip( myTool, "You're hovering above myTool." ); // register popup message for 'myTool'
...
myTip.Show(myTool, "Forced modal pop-up.", 1000 ); // display pop up message for 1 sec at 'myTool'