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.Design Patterns
8.Development Class
9.Event
10.File Stream
11.Generics
12.GUI Windows Form
13.Language Basics
14.LINQ
15.Network
16.Office
17.Reflection
18.Regular Expressions
19.Security
20.Services Event
21.Thread
22.Web Services
23.Windows
24.Windows Presentation Foundation
25.XML
26.XML LINQ
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source
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
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.