Create an AboutBox : AboutBox « Components « C# / C Sharp

Home
C# / C Sharp
1.2D Graphics
2.Class Interface
3.Collections Data Structure
4.Components
5.Data Types
6.Database ADO.net
7.Date Time
8.Design Patterns
9.Development Class
10.Event
11.File Stream
12.Generics
13.GUI Windows Form
14.Internationalization I18N
15.Language Basics
16.LINQ
17.Network
18.Office
19.Reflection
20.Regular Expressions
21.Security
22.Services Event
23.Thread
24.Web Services
25.Windows
26.Windows Presentation Foundation
27.XML
28.XML LINQ
C# / C Sharp » Components » AboutBoxScreenshots 
Create an AboutBox
Create an AboutBox



    using System;
    using System.Windows.Forms;
    using System.Drawing;

  public class AboutBox : Form {
    public String Author="java2s";
    public String AppName = "about dialog";
    public String Version = "1.0";

    public AboutBox ()
    {
      InitDialog ();
    }

    private void InitDialog ()
    {
      this.ClientSize = new Size (250140);
      this.Text = "About";
      this.FormBorderStyle  = FormBorderStyle.FixedDialog;
      this.ControlBox    = false;
      this.MinimizeBox  = false;
      this.MaximizeBox  = false;

      Button wndClose = new Button ();
      wndClose.Text = "OK";
      wndClose.Location = new Point (90100);
      wndClose.Size = new Size (7224);
      wndClose.Click += new EventHandler (About_OK);

      Label wndAuthorLabel = new Label ();
      wndAuthorLabel.Text = "Author:";
      wndAuthorLabel.Location = new Point (55);
      wndAuthorLabel.Size = new Size (7224);

      Label wndAuthor = new Label ();
      wndAuthor.Text = Author;
      wndAuthor.Location = new Point (805);
      wndAuthor.Size = new Size (8024);

      Label wndProdNameLabel = new Label ();
      wndProdNameLabel.Text = "Product:";
      wndProdNameLabel.Location = new Point (530);
      wndProdNameLabel.Size = new Size (7224);

      Label wndProdName = new Label ();
      wndProdName.Text = AppName;
      wndProdName.Location = new Point (8030);
      wndProdName.Size = new Size (12024);

      Label wndVersionLabel = new Label ();
      wndVersionLabel.Text = "Version:";
      wndVersionLabel.Location = new Point (555);
      wndVersionLabel.Size = new Size (7224);

      Label wndVersion = new Label ();
      wndVersion.Text = Version;
      wndVersion.Location = new Point (8055);
      wndVersion.Size = new Size (7224);

      this.Controls.AddRangenew Control [] {
                        wndClose,
                        wndAuthorLabel,
                        wndProdNameLabel,
                        wndVersionLabel,
                        wndAuthor,
                        wndProdName,
                        wndVersion
                        });
      this.StartPosition = FormStartPosition.CenterParent;
      this.ShowDialog ();
    }

    private void About_OK (Object source, EventArgs e)
    {
      Control wndCtrl = ((Button)source).Parent;
      ((Form)wndCtrl).Close ();
    }
    public static void Main(){
      new AboutBox();
    }
  }

           
       
Related examples in the same category
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.