I need to add a text line in a specified point of a windows form. In this form I draw something and I would like to describe the draw exactly where it is pointed.

Is there a way to add a tooltip in a specified point of a Form?

For example something like:

Point pt = new Point (490,567);
ToolTip tt = new ToolTip();

Other ways I've tried:

1- Label class, but when I add the control with Controls.Add(label) the system restart execution of the draw, I don't know why.
2- TextBox class, but execution become quite slow when the program add the textbox.

If you have some suggestions also for these 2 other ways it will be so appreciated :)


Edited by samp4ever: n/a

5 Years
Discussion Span
Last Post by ddanbe
Featured Replies
  • 1
    ddanbe 2,525   5 Years Ago

    While you are busy drawing some shapes, why not use that opportunity to also draw some strings? [url]http://msdn.microsoft.com/en-us/library/76c5db29.aspx[/url] Read More


Try it this way:

private void button1_Click(object sender, EventArgs e)
            Label l = new Label();
            l.Location = new Point(100, 100);
            l.Text = "This is a text";

Thanks, I've tried this solution and I think is the best one but as I said it has a strange behavior.

I have to draw some shapes and when the shape is drawn I have to put a comment in the point where it starts. The strange behavior of labels is that when the comment is added, the program restart execution of the drawing.. anyone knows why does it happen?



where are you writing the code of adding text to the label?

I've put the code during the drawing..but the label wait for the drawing then put the label and restart execution..

While you are busy drawing some shapes, why not use that opportunity to also draw some strings?

That's a great solution thanks ;)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.