0
我想如果txbStart_MouseClick得到了之前點擊該進程(當我點擊btnWeiss按鈕)只啓動。所以我需要一個if。但我怎麼說:一個按鈕,查詢是否被點擊
txbStart_MouseClick == true ? (if(txbMouseClick ==true) <-- i get an error^^)
我的代碼如下:
private void btnWeiss_Click(object sender, EventArgs e)
{
int summe = 0, z;
lblAnzeige.Text = " ";
while (summe <= 0)
{
z = r.Next(1, 6);
summe = summe + z;
}
lblAnzeige.Text += colors[summe - 1] + "\n";
if (ckbExtrem.Checked == false)
{
lblAnzeige.ForeColor = myColors[Farbe.Next(myColors.Count)];
}
else
{
lblAnzeige.ForeColor = Color.FromArgb(Farbe.Next(256), Farbe.Next(256), Farbe.Next(256));
}
}
private void txbStart_MouseClick(object sender, MouseEventArgs e)
{
int summe = 0, z;
lblAnzeige.Text = " ";
txbStart.Text = " ";
textBox1.Text = " ";
while (summe <= 0)
{
z = r.Next(1, 6);
summe = summe + z;
}
lblAnzeige.Text += colors[summe - 1] + "\n";
if (ckbExtrem.Checked == false)
{
lblAnzeige.ForeColor = myColors[Farbe.Next(myColors.Count)];
}
else
{
lblAnzeige.ForeColor = Color.FromArgb(Farbe.Next(256), Farbe.Next(256), Farbe.Next(256));
}
爲了澄清,設置布爾標誌設置爲true在txbStart_MouseClick事件處理程序,並檢查它在btnWeiss.MouseClick事件處理程序。 –