Rev 1200 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
using System;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Reflection;
namespace TCPproxy
{
public class AboutForm : Form
{
private System.ComponentModel.IContainer components = null;
private Label copyrightLabel;
private Button okButton;
private LinkLabel homePageLabel;
private Label versionLabel;
private Label appNameLabel;
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.copyrightLabel = new System.Windows.Forms.Label();
this.okButton = new System.Windows.Forms.Button();
this.homePageLabel = new System.Windows.Forms.LinkLabel();
this.versionLabel = new System.Windows.Forms.Label();
this.appNameLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// copyrightLabel
//
this.copyrightLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.copyrightLabel.Location = new System.Drawing.Point(32, 89);
this.copyrightLabel.Name = "copyrightLabel";
this.copyrightLabel.Size = new System.Drawing.Size(248, 49);
this.copyrightLabel.TabIndex = 1;
this.copyrightLabel.Text = "Copyright [copyright notice]";
this.copyrightLabel.UseMnemonic = false;
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.okButton.Location = new System.Drawing.Point(206, 172);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 3;
this.okButton.Text = "OK";
//
// homePageLabel
//
this.homePageLabel.AutoSize = true;
this.homePageLabel.Location = new System.Drawing.Point(32, 147);
this.homePageLabel.Name = "homePageLabel";
this.homePageLabel.Size = new System.Drawing.Size(229, 13);
this.homePageLabel.TabIndex = 4;
this.homePageLabel.TabStop = true;
this.homePageLabel.Text = "http://www.26th.net/public/projects/tcpproxy/";
this.homePageLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.homePageLabel_LinkClicked);
//
// versionLabel
//
this.versionLabel.AutoSize = true;
this.versionLabel.Location = new System.Drawing.Point(32, 64);
this.versionLabel.Name = "versionLabel";
this.versionLabel.Size = new System.Drawing.Size(111, 13);
this.versionLabel.TabIndex = 5;
this.versionLabel.Text = "Version [build number]";
this.versionLabel.UseMnemonic = false;
//
// appNameLabel
//
this.appNameLabel.AutoSize = true;
this.appNameLabel.Font = new System.Drawing.Font("Arial", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.appNameLabel.Location = new System.Drawing.Point(30, 9);
this.appNameLabel.Name = "appNameLabel";
this.appNameLabel.Size = new System.Drawing.Size(72, 29);
this.appNameLabel.TabIndex = 8;
this.appNameLabel.Text = "[title]";
this.appNameLabel.UseMnemonic = false;
//
// AboutForm
//
this.AcceptButton = this.okButton;
this.CancelButton = this.okButton;
this.ClientSize = new System.Drawing.Size(293, 207);
this.Controls.Add(this.appNameLabel);
this.Controls.Add(this.versionLabel);
this.Controls.Add(this.homePageLabel);
this.Controls.Add(this.okButton);
this.Controls.Add(this.copyrightLabel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "AboutForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "About [title]";
this.Load += new System.EventHandler(this.AboutForm_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
public AboutForm()
{
InitializeComponent();
}
protected override void Dispose(bool disposing)
{
if(disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
private void homePageLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
homePageLabel.LinkVisited = true;
System.Diagnostics.Process.Start(homePageLabel.Text);
}
private void AboutForm_Load(object sender, EventArgs e)
{
Assembly running = Assembly.GetExecutingAssembly();
AssemblyName name = running.GetName();
// get version
versionLabel.Text = string.Format("Version {0}.{1}.{2}",
name.Version.Major, name.Version.Minor, name.Version.Build);
// get other info
string copyright = "";
string title = "";
foreach (object a in running.GetCustomAttributes(false))
{
if (a is AssemblyCopyrightAttribute)
{
copyright = (a as AssemblyCopyrightAttribute).Copyright;
}
else if (a is AssemblyTitleAttribute)
{
title = (a as AssemblyTitleAttribute).Title;
}
}
// show
this.Text = string.Format("About {0}", title);
appNameLabel.Text = title;
copyrightLabel.Text = copyright;
}
}
}