Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Make an about box in c#

Posted on 2009-02-19
3
Medium Priority
?
1,840 Views
Last Modified: 2012-05-06
Plz tell how can i make an about box in c#.I want this about box to shows Name,Version,Product
0
Comment
Question by:kyrenator
2 Comments
 
LVL 5

Expert Comment

by:pghn
ID: 23682540
Try something like this:
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 (250, 140);
      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 (90, 100);
      wndClose.Size = new Size (72, 24);
      wndClose.Click += new EventHandler (About_OK);
 
      Label wndAuthorLabel = new Label ();
      wndAuthorLabel.Text = "Author:";
      wndAuthorLabel.Location = new Point (5, 5);
      wndAuthorLabel.Size = new Size (72, 24);
 
      Label wndAuthor = new Label ();
      wndAuthor.Text = Author;
      wndAuthor.Location = new Point (80, 5);
      wndAuthor.Size = new Size (80, 24);
 
      Label wndProdNameLabel = new Label ();
      wndProdNameLabel.Text = "Product:";
      wndProdNameLabel.Location = new Point (5, 30);
      wndProdNameLabel.Size = new Size (72, 24);
 
      Label wndProdName = new Label ();
      wndProdName.Text = AppName;
      wndProdName.Location = new Point (80, 30);
      wndProdName.Size = new Size (120, 24);
 
      Label wndVersionLabel = new Label ();
      wndVersionLabel.Text = "Version:";
      wndVersionLabel.Location = new Point (5, 55);
      wndVersionLabel.Size = new Size (72, 24);
 
      Label wndVersion = new Label ();
      wndVersion.Text = Version;
      wndVersion.Location = new Point (80, 55);
      wndVersion.Size = new Size (72, 24);
 
      this.Controls.AddRange( new 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();
    }
  }

Open in new window

0
 
LVL 1

Accepted Solution

by:
shutout5591 earned 2000 total points
ID: 26091525
Are you in Visual Studio?

If so, right click Project, AddNewItem > "Windows Forms" > "AboutBox"

This will create a "pre-created" about box that uses ur assemblies metadata to generate the information. It is real easy to modify if you have a need to.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
Suggested Courses
Course of the Month21 days, 5 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question