Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Créer une boîte de dialogue ‘A propos de’

Créer,une,zone,texte,numérique
{filelink=15665}

    using System;
    using System.Windows.Forms;
    using System.Drawing;
 
  public class ExempleApropos : Form 
 
  {
  public static void Main()
    {
        new ExempleApropos();
    } 
 
    public String Author="Mes Exemples";
    public String Version = "1.0";
    public String AppName = "Exemples et Cours";
 
    public ExempleApropos ()
    {
      InitDialog ();
    }
 
    private void InitDialog ()
    {
      this.ClientSize = new Size (250, 140);
      this.Text = "A porpos de";
      this.FormBorderStyle  = FormBorderStyle.FixedDialog;
      this.ControlBox    = false;
      this.MinimizeBox  = false;
      this.MaximizeBox  = false;
 
      Button wndClose = new Button ();
      wndClose.Text = "OK";
      wndClose.Location = new Point (90, 100);
      wndClose.Size = new Size (72, 24);
      wndClose.Click += new EventHandler (About_OK);
 
      Label labelAuteur = new Label ();
      labelAuteur.Text = "Auteur:";
      labelAuteur.Location = new Point (5, 5);
      labelAuteur.Size = new Size (72, 24);
 
      Label fenAuteur = new Label ();
      fenAuteur.Text = Author;
      fenAuteur.Location = new Point (80, 5);
      fenAuteur.Size = new Size (80, 24);
 
      Label labelversion = new Label ();
      labelversion.Text = "Version:";
      labelversion.Location = new Point (5, 55);
      labelversion.Size = new Size (72, 24);
 
      Label fenVersion = new Label ();
      fenVersion.Text = Version;
      fenVersion.Location = new Point (80, 55);
      fenVersion.Size = new Size (72, 24);
 
      Label labelNomProd = new Label ();
      labelNomProd.Text = "Produit:";
      labelNomProd.Location = new Point (5, 30);
      labelNomProd.Size = new Size (72, 24);
 
      Label fenNomProd = new Label ();
      fenNomProd.Text = AppName;
      fenNomProd.Location = new Point (80, 30);
      fenNomProd.Size = new Size (120, 24);
 
      this.Controls.AddRange( new Control [] {
                        wndClose,
                        labelAuteur,
                        labelNomProd,
                        labelversion,
                        fenAuteur,
                        fenNomProd,
                        fenVersion
                        });
      this.StartPosition = FormStartPosition.CenterParent;
      this.ShowDialog ();
    }
 
    private void About_OK (Object source, EventArgs e)
    {
      Control wndCtrl = ((Button)source).Parent;
      ((Form)wndCtrl).Close ();
    }
 
  }

No comments yet.

Leave a Comment