I want to use timer in my application, i have the doubt is there any option to pause the timer while the window is minimized and then it will start counting when the window is maximized.Hope the reply will be useful.
Thanks in advance.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Nilanka DharmadasaPosted Jan 22, 2010, 7:47 AM
Hi Nila,
You can do it with 'SizeChanged' event of form.
private void Form1_SizeChanged(object sender, EventArgs e){
if (this.WindowState == FormWindowState.Minimized)
{
timer1.Enabled = false;
}
else
{
timer1.Enabled = true;
};
}
Check my code. It shows you the exact solution.Please do not forget to tick 'Do you like this answer' checkbox if my answer helps you.
Santhosh NPosted Jan 22, 2010, 12:50 AM