Customizing ToolTips or mimicking their functionality...

Hi all,
I was wondering how tool tips worked. I basically need to get an image into a tooltip (if possible, which I doubt) or make something that functions similarly to a tooltip. I've tried to just draw directly on the form, but it puts the image on the background behind all the controls, and it can't exceed the bounds of the form. How can i achieve this? Also, i want the picture to be changeable while the "tooltip" is still being displayed. Is that possible?

Here is an exact equivalent in JavaScript:
http://javascript.internet.com/text-effects/dhtml-tooltip-generator.html
Just mouse over the link that says: Here is an example of how it works (Mouse Over Me!).

The event takes place on a textbox, and the tooltip should appear right next to the cursor and should not be limited to the bounds of the form (ie able to draw beyond the sides of the form). All I would need in my tooltip would be a picture and perhaps a small string caption. Any help would be great.
mirthlessAsked:
Who is Participating?
 
dunglaConnect With a Mentor Commented:
I think you can reach this by making a form and consider this as a tooltip. Then handle your mouse move/leave events to display tooltip form.

Take a look at my sample:

// Tooltip form
namespace csWin
{
      /// <summary>
      /// Customized form, consider as a Tooltip
      /// </summary>
      public class myToolTip : System.Windows.Forms.Form
      {
            private System.Windows.Forms.Label label1;
            /// <summary>
            /// Required designer variable.
            /// </summary>
            private System.ComponentModel.Container components = null;

            public myToolTip()
            {
                  //
                  // Required for Windows Form Designer support
                  //
                  InitializeComponent();
            }
            public myToolTip(int X, int Y)
            {
                  //
                  // Required for Windows Form Designer support
                  //
                  InitializeComponent();
                  this.Location = new Point(X, Y);
                  this.ShowInTaskbar = false;
            }
      }
}

// main form
namespace csWin
{
      public class MainForm : System.Windows.Forms.Form
      {
            myToolTip frmTooltip = null;
            private void lblMouseOver_MouseEnter(object sender, System.EventArgs e)
            {
                  Point p = MainForm.GetMouseOrd();
                  // display the form under to cursor
                  frmTooltip = new myToolTip(p.X, p.Y);
                  frmTooltip.Show();
            }

            private void lblMouseOver_MouseLeave(object sender, System.EventArgs e)
            {
                  if (frmTooltip != null)
                        frmTooltip.Close();
            }
            private static Point GetMouseOrd()
            {
                  return new Point(MainForm.MousePosition.X, MainForm.MousePosition.Y);
            }
}

Hopes this help
-D
0
 
dunglaCommented:
Actually, the javascript will draw a <div> is not a standard tooltip. You can download the script from http://www.walterzorn.com/tooltip/tooltip_e.htm#download. This is very nice javascript tooltip which allow you input image as well.
0
 
mirthlessAuthor Commented:
I'm sorry, I just realized I didn't specify the language. I'm working on a C# windows application, and I only used the JavaScript to show an example of the functionality I'm looking for from the user perspective. I just have the additional twist of being able to update the image without having to mouse off and then back on. Rather, you should be able to watch the image change as you're mouse is over the textbox if it gets updated.
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
mirthlessAuthor Commented:
Sorry I was away for so long.

Well, it is a possibility, but I was hoping for something that didn't use other forms, because then you split the event handling into two seperate forms rather than keep it all in one place. Is it possible?
0
 
dunglaCommented:
I think is impossible to do that. In my commerical project, I'll always have my own message box and my own tooltip control like that. Very simple and clear. So you can customize very thing by your own
0
 
mirthlessAuthor Commented:
Alright, I'll give it a try. Now that I think about it, to get the image to be under constant updating, it would have to be in a form of its own. Thanks for the help!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.