リアルタイムで16秒経過するとタイマーを止めようとしていますが、どうすればいいのか分かりません。どのようにリアルタイムで秒数秒でタイマーを停止できますか?
私はこの小さな例を作った:picturebox1がpicturebox2と交差するとき、このアクションはタイマーを作動させ、このタイマーはリアルタイムで16秒間にpicturebox3を表示し、それを停止した後(タイマー)(picturebox3はショー)。
(スペイン語のStackOverflowには多くの情報がありません)私は、WindowsフォームとC#
private void timer2_Tick(object sender, EventArgs e)
{
pictureBox7.Hide();
if ((pictureBox3.Bounds.IntersectsWith(pictureBox2.Bounds) && pictureBox2.Visible) || (pictureBox5.Bounds.IntersectsWith(pictureBox2.Bounds) && pictureBox2.Visible))
{
puntaje++;
this.Text = "Puntaje: " + puntaje;
if (puntaje % 5 == 0)
{
timer3.Enabled=true;
//This is the part where i want set down the timer3, timer 2 is on
}
}
タイマーは非常に正確である必要がありますか?ちょうど16.000000000000秒ですか?そのレベルの精度がない場合は、 'System.Timers.Timer.Elapsed'イベント(https://msdn.microsoft.com/en-us/library/system.timers.timer.elapsed(v=vs) .110).aspx) – Svek