Given .net control, can I get a tooltip?

I have .net control (ok, a lot of them). I can call methods for any given control, but I cannot create new controls or access the static methods of classes for which I do not have controls. I do not have access to tooltip objects. Is there a way to get a tooltip object for this control?

(We use a rather limited testing automation environment in Java to access controls in an application written in C # .net, is the background for this odd request)

ETA: Perhaps I did not clarify the situation. I am not trying to set a tooltip; I am trying to get an existing tooltip. And I can not create new controls, so everything that includes new Foo()will not work.

+3
source share
4 answers

This seems impossible. :( In order to get a tooltip for a control, I need access to the ToolTip class, and this is normal if I program the controls, but otherwise I am not exposed.

+2
source
string text = toolTip1.GetToolTip(yourControl);

This gives you a tooltip text for yourControl.

+2
source

,

System.Windows.Forms.ToolTip ToolTip1 = new System.Windows.Forms.ToolTip();
ToolTip1.SetToolTip(this.textBox1, "Hello");
0

Add popup event. Below the code gets the value set for the tooltip, and also displays its status text field in MDIForm.

    private void toolTip1_Popup(object sender, PopupEventArgs e)
    {
        Control TheControl = e.AssociatedControl;
        cls_Global.gf_MDIForm.DisplayMsg(this.toolTip1.GetToolTip(TheControl) + "");
    }
-1
source

All Articles