怎么样使用控件的Created属性?
我写了一个简单的程序,试想测试控件的Created属性。程序如下
using System;
using System.Windows.Forms;
namespace test_created
{
/// <summary>
/// Summary description for Class1
/// </summary>
public class Class1
{
public static void Main()
{
Form form = new Form();
form.Text = "TEST";
Button button = new Button();
button.Text = "confirm";
form.Controls.Add(button);
if (button.Created)
{
Label label = new Label();
label.Text = "button is created";
label.AutoSize = true;
form.Controls.Add(label);
}
Application.Run(form);
}
}
}
编译是没有问题的。但没有我想要的结果。请教