Imports System.ComponentModel

Public Class Form12
    Dim time As Integer = 120
    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Label1.Text = "Arrêt du pc dans: " & time & "s"
        If time = 0 Then
            stoppc()
        Else
            time = time - 1
        End If
    End Sub
    Sub stoppc()
        Shell("shutdown /p /f")
        End
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        stoppc()
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Close()
    End Sub

    Private Sub Form12_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
        Timer1.Stop()
        MsgBox("Sauvagarde terminer", MsgBoxStyle.Information)
        time = 120
    End Sub

    Private Sub Form12_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        BackColor = Form4.BackColor
        ForeColor = Form4.ForeColor
        Button1.BackColor = BackColor
        Button2.BackColor = BackColor
        Timer1.Start()
        Label1.Text = "Arrêt du pc dans: " & time & "s"
    End Sub
End Class