Why are messages displayed at design-time?
My code is :
class Class1 : TextBox
{
public Class1()
{
this.Resize += new EventHandler(Class1_Resize);
}
void Class1_Resize(object sender, EventArgs e)
{
MessageBox.Show("Resize");
}
}
Pic :
Because that's the way the Form designer works. It's actually instantiating your control when it displays it in your form at design-time. Thus when you resize the control in the designer, your code for the message box fires.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.