form1中有3个checkBox,它们都注册了下面这个事件
int a2 = 0;
CheckBox che = null;
private void checkBox1_MouseDown(object sender, MouseEventArgs e)
{
if ((sender as CheckBox) != che)
{
a2 = 0;
che = sender as CheckBox;
}
if (e.Button == MouseButtons.Left)
{
a2++;
if (a2 % 2 != 0)
{
(sender as CheckBox).Checked = true;
}
if (a2 % 2 == 0)
{
(sender as CheckBox).Checked = false;
}
}
}我想问,为什么checkBox,点等一下,始终点不起呢,第二下之后,就能点起了
int a2 = 0;
CheckBox che = null;
private void checkBox1_MouseDown(object sender, MouseEventArgs e)
{
if ((sender as CheckBox) != che)
{
a2 = 0;
che = sender as CheckBox;
}
if (e.Button == MouseButtons.Left)
{
a2++;
if (a2 % 2 != 0)
{
(sender as CheckBox).Checked = true;
}
if (a2 % 2 == 0)
{
(sender as CheckBox).Checked = false;
}
}
}我想问,为什么checkBox,点等一下,始终点不起呢,第二下之后,就能点起了
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货