gpt4 book ai didi

c# - 将显示的随机化按钮

转载 作者:行者123 更新时间:2023-12-02 05:02:24 26 4
gpt4 key购买 nike

<分区>

我是 C# 编程的初学者,我正在尝试随机按钮,当我按下按钮时会显示该按钮。(我正在制作一款地鼠游戏,但使用按钮作为地鼠,我想随机显示最多 2 个按钮)

private void Whack_A_Mole_Load(object sender, EventArgs e)
{
button1.Visible = false;
button2.Visible = false;
button3.Visible = false;
button4.Visible = false;
button5.Visible = false;
button6.Visible = false;
button7.Visible = false;
button8.Visible = false;
button9.Visible = false;
}

private void button10_Click(object sender, EventArgs e)
{
timer1.Enabled = true;
timer2.Enabled = false;
button10.Enabled = false;
btnStop.Enabled = true;
button1.Image =(Properties.Resources.Mole);
Random random = new Random();
var randombutton = random.Next(1, 2);
}

我就是这样

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com