Click here to Skip to main content
13,139,569 members (49,945 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I am developing address book in I have developed it, but now i want to minimize my form automatically when it is not used for more than one minute.
Please help me out.
Posted 25-Jan-13 23:57pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Add a Timer to your form.
Set the timer Interval to 1000 (or one second in milliseconds) and add a Tick event handler
Add a class level private integer and set it to 60 - call it inactiveTime
In the Tick handler, check the value of inactiveTime. If it is zero, do nothing.
Otherwise, decrement it by one. If it is now zero, set the form WindowState to FormWindowState.Minimized
Whenever the user does anything you count as activity, set inactiveTime back to 60.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170915.1 | Last Updated 26 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100