还差最后一步比较大小,不会了,求教
以下代码,求大神
int n;
private void button1_Click(object sender, EventArgs e)
{
int p_x = 10;
int p_y = 60;
for(int i=0;i<100;i++)
{
Button bt = new Button();
bt.Text = (i + 1).ToString();
bt.Name = (i + 1).ToString();
bt.Width = bt.Height = 35; bt.Location = new Point(p_x, p_y);
bt.Location = new Point(p_x, p_y);
bt.Click += new EventHandler(bt_Click);
p_x += 36;
if((i+1)%10==0)
{
p_x = 10;
p_y += 36;
}
Controls.Add(bt);
}
Thread G_th = new System.Threading.Thread(delegate()
{
int count = 0;
while (true)
{
count = ++count > 1000000000 ? 0 : count;
this.Invoke(
(MethodInvoker)delegate
{
label1.Text ="计时:" + count.ToString()+"秒";
});
System.Threading.Thread.Sleep(1000);
}
});
G_th.IsBackground = true;
G_th.Start();
Random num =new Random();
n = num.Next(1, 100);
button1.Enabled = false;
}
void bt_Click(object sender, EventArgs e)
{
throw new NotImplementedException();
}
------来自 爱贴吧HD for Windows8
以下代码,求大神
int n;
private void button1_Click(object sender, EventArgs e)
{
int p_x = 10;
int p_y = 60;
for(int i=0;i<100;i++)
{
Button bt = new Button();
bt.Text = (i + 1).ToString();
bt.Name = (i + 1).ToString();
bt.Width = bt.Height = 35; bt.Location = new Point(p_x, p_y);
bt.Location = new Point(p_x, p_y);
bt.Click += new EventHandler(bt_Click);
p_x += 36;
if((i+1)%10==0)
{
p_x = 10;
p_y += 36;
}
Controls.Add(bt);
}
Thread G_th = new System.Threading.Thread(delegate()
{
int count = 0;
while (true)
{
count = ++count > 1000000000 ? 0 : count;
this.Invoke(
(MethodInvoker)delegate
{
label1.Text ="计时:" + count.ToString()+"秒";
});
System.Threading.Thread.Sleep(1000);
}
});
G_th.IsBackground = true;
G_th.Start();
Random num =new Random();
n = num.Next(1, 100);
button1.Enabled = false;
}
void bt_Click(object sender, EventArgs e)
{
throw new NotImplementedException();
}
------来自 爱贴吧HD for Windows8
