Gestion des événement d’un ‘Form’

Author:

Utilitaire,Plateforme:,non,edité
{filelink=17880}

using System;
using System.Threading;
using System.Windows.Forms;

public class EvenementForm : Form {

    public static void Main()
    {
        EvenementForm FormObject = new EvenementForm();
        FormObject.Text = "Voici un exemple d'un form Simple";

        Application.ApplicationExit += new EventHandler(OnApplicationExit);
        Application.Idle += new EventHandler(OnIdle);
        Application.ThreadExit += new EventHandler(OnThreadExit);
        Application.Run(FormObject);
    }
    public static void OnApplicationExit(object sender, EventArgs e) {
        try {
            Console.WriteLine("Fermeture de l'application.");
        } catch (NotSupportedException) {
        }
    }

    public static void OnIdle(object sender, EventArgs e) {
        Console.WriteLine("Un événement invoqué est terminé, au repos");
    }

    public static void OnThreadExit(object sender, EventArgs e) {
        Console.WriteLine("Arrêt du thread");
    }

}

Leave a Reply

Your email address will not be published. Required fields are marked *