C # tooltip usage

Source: Internet
Author: User

The method for setting the position of the winform tooltip is not found, and the direction of the arrow is also found,

In fact, these functions can be implemented by tooltip.

Cs code

ToolTip tt = new ToolTip ();
Private void Form2_Load (object sender, EventArgs e)
{
// Bubble display

Tt. IsBalloon = true;

// This method is used.

// Msdn has checked the definition of this method: It is prompted when you place the mouse over the control. It can be used with other attributes and I won't talk about it if I can search it online.

// The display is an arrow down.

// If this method is not used, the arrow orientation is downward, and the position of the tooltip cannot be accurately located. If this method is used, everything becomes so simple.

 

Tt. SetToolTip (this. textBox1, "Enter the user name ");

}

Private void button#click (object sender, EventArgs e)

{

If (textBox1.Text. Length = 0)

{

// The following method displays an arrow up by default.

// The position is in the middle of the text box, and the position can be determined by the reconstruction method. 1000 indicates that the display time is 1 s.

 

Tt. Show ("Enter the user name", textBox1, 1000 );

TextBox1.Focus ();

}

}

As follows:

 

 

Hope to help you.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.