我正在创建一个WinForm应用程序,使用网络摄像头拍摄人物照片,并尝试创建倒计时效果。我有4张图片,想要循环播放,但这证明是相当棘手的。
我使用计时器来计算秒数,但所有发生的事情只是应用程序稍微滞后,然后显示最后一张图片。请问有谁知道我如何完成这个任务吗?
以下是我的代码:
我使用计时器来计算秒数,但所有发生的事情只是应用程序稍微滞后,然后显示最后一张图片。请问有谁知道我如何完成这个任务吗?
以下是我的代码:
int counter = 0;
// start the counter to swap the images
tmCountDown.Start();
while (counter < 4)
{
// holding off picture taking
}
// reset counter for timer
counter = 0;
tmCountDown.Stop();
/// <summary>
/// timer event to switch between the countdown images
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void tmCountDown_Tick(object sender, EventArgs e)
{
counter++;
//MessageBox.Show("c:/vrfid/apppics/" + counter + ".jpg");
pbCountDown.Image = new Bitmap("c:/vrfid/apppics/" + counter + ".jpg");
}
this.Refresh()
了吗? - El Ronnocothis.Refresh
没有起到作用。什么也没有发生。 - MattBH