Setting the Timeout function in the Window Forms application

It has long been known how I can create a timeout function in a Windows forms application.

The application is event driven, but I’m thinking about somehow using a timer that counts for 10 minutes, and one timer goes in cycles, then we are the user timeout.

I have a problem: how can I reset the timer every time I move or click the mouse.

Any help was appreciated.

Greetings

+3
source share
3 answers

you can use System.Windows.Forms.Timer.

you can drag it from the toolbar onto the surface of the designer.

, Interval (), Enabled false.

timer Enabled true.

( # - )

private void Form1_Load(object sender, EventArgs e) { timer1.Enabled = true; }

, ,

private void timer1_Tick(object sender, EventArgs e) { Close(); }

+1

. 0 ?

Private Sub Form1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
    Me.Timer1.Stop()
    Me.Timer1.Start()
End Sub
0

, , - system.timer .

, , - , , ​​ "" ( , ) . , , , 10 .

, .

, .

0

Source: https://habr.com/ru/post/1757136/


All Articles