使图片框(GIF)出现x秒,然后消失

时间:2014-01-29 04:37:39

标签: c# visibility picturebox

在单一方法中,我如何(按顺序):

public void method()
{
    picturebox1.visible = true;

    //wait 2 seconds;

    picturebox1.visible = false;
}

可能很容易回答,但我的脑筋现在已经炒了,抱歉。

2 个答案:

答案 0 :(得分:0)

public async void method()
{  
     pictureBox1.Visible = true;

     await Task.Delay(2000);

     pictureBox1.Visible = false;

}

答案 1 :(得分:0)

public void method()
{
    picturebox1.visible = true;

    //wait 2 seconds;
    Thread.Sleep(2000);

    picturebox1.visible = false;
}