问题
Hello I am kind of new to C#... I have a picturebox which is my control. It's meant to be rapidly clicked on. I want to make it so when it is clicked a certain amount of times a second picturebox which has a .gif in it becomes visible. And when a certain amount of time has past without clicking the first picturebox the second disappears. Is there a way to do this? Maybe with timers. Some sample code will help me out A LOT! Thanks to all in advance! :)
回答1:
Try This:
System.Windows.Forms.Timer timer1 = new System.Windows.Forms.Timer();
timer1.Interval=60000;//one minute
timer1.Tick += new System.EventHandler(timer1_Tick);
timer1.Start();
private void pictureBox1_Click(object sender, EventArgs e)
{
timer1.Stop();
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
//do whatever you want
pictureBox2.Visible = false;
}
来源:https://stackoverflow.com/questions/22425257/i-want-to-make-a-picturebox-disappear-after-a-certain-time-has-passed-without-us