Thursday, February 17, 2011

.Net 2.0 Winform Label Tool Tip

This has got to be something I just missed, but how do I add a tool tip to a label?

I saw something on the web about handling the mouse hover event, but how would I even handle it in code?

From stackoverflow
  • Add in your form the TooTip from the ToolBox than click once in your label and you'll see ToolTip in the property box.

  • Drop the TOOLTIP control onto your form. At that point, a ToolTip attribute appears in the Label's properties in the Designer (and is accessible in the code)

  • Don't you just drop a ToolTip on a form, and then select the label and set the "Tooltip on Tooltip1" property? At least I remember doing it that way, or something very close to it.

    Programmatically from MSDN:

    System.Windows.Forms.ToolTip ToolTip1 = new System.Windows.Forms.ToolTip();
    ToolTip1.SetToolTip(this.textBox1, "Hello");
    
  • button = new Button(); 
    button.Content = "Hover over me."; 
    tt = new ToolTip(); 
    tt.Content = "Created with C#"; 
    button.ToolTip = tt; 
    cv2.Children.Add(button);
    

    from http://msdn.microsoft.com/en-us/library/ms754034.aspx

    Richard Morgan : FYI: the code above is for WPF
  • ahhhhh

    i knew it was so freaking easy.

    thanks guys

0 comments:

Post a Comment