代码如下对比C1TextBox
c1Label1.TextDetached = true;
c1Label1.DataType = typeof (int);
c1Label1.ValueChanged += c1Label1_ValueChanged;
int v = 20;
for (int i = 0; i < 5; i++)
{
c1Label1.Value = v;
}
c1TextBox1.TextDetached = true;
c1TextBox1.DataType = typeof (int);
c1TextBox1.ValueChanged += c1TextBox1_ValueChanged;
for (int i = 0; i < 5; i++)
{
c1TextBox1.Value = v;
}
------------------------------------------------
private void c1TextBox1_ValueChanged(object sender, EventArgs e)
{
Console.WriteLine("c1TextBox1 changed");
}
private void c1Label1_ValueChanged(object sender, EventArgs e)
{
Console.WriteLine("c1Label1 changed");
}
运行结果:
c1Label1 changed
c1Label1 changed
c1Label1 changed
c1Label1 changed
c1Label1 changed
c1TextBox1 changed
|