[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Customizing ToolTips or mimicking their functionality...

Posted on 2006-05-07
6
Medium Priority
?
360 Views
Last Modified: 2012-05-05
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.
0
Comment
Question by:mirthless
  • 3
  • 3
6 Comments
 
LVL 13

Expert Comment

by:dungla
ID: 16627526
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
 

Author Comment

by:mirthless
ID: 16627590
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
 
LVL 13

Accepted Solution

by:
dungla earned 500 total points
ID: 16627922
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:mirthless
ID: 16649302
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
 
LVL 13

Expert Comment

by:dungla
ID: 16656602
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
 

Author Comment

by:mirthless
ID: 16701750
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Loops Section Overview
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question