4,7 → 4,6 |
using System.Drawing; |
using System.Text; |
using System.Windows.Forms; |
using System.Reflection; |
|
namespace TCPproxy |
{ |
11,11 → 10,14 |
public class AboutForm : Form |
{ |
private System.ComponentModel.IContainer components = null; |
private Label appLabel; |
private Label copyrightLabel; |
private Label license1Label; |
private Button okButton; |
private LinkLabel homePageLabel; |
private Label versionLabel; |
private Label appNameLabel; |
private Label license2Label; |
private Label warrantyLabel; |
|
#region Windows Form Designer generated code |
|
25,29 → 27,49 |
/// </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.appLabel = new Label(); |
this.copyrightLabel = new Label(); |
this.license1Label = new Label(); |
this.okButton = new Button(); |
this.homePageLabel = new LinkLabel(); |
this.versionLabel = new Label(); |
this.license2Label = new Label(); |
this.warrantyLabel = new Label(); |
this.SuspendLayout(); |
// |
// appLabel |
// |
this.appLabel.AutoSize = true; |
this.appLabel.Font = new System.Drawing.Font("Arial", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); |
this.appLabel.Location = new System.Drawing.Point(12, 16); |
this.appLabel.Name = "appLabel"; |
this.appLabel.Size = new System.Drawing.Size(146, 32); |
this.appLabel.TabIndex = 0; |
this.appLabel.Text = "TCPproxy"; |
// |
// 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.AutoSize = true; |
this.copyrightLabel.Location = new System.Drawing.Point(32, 60); |
this.copyrightLabel.Name = "copyrightLabel"; |
this.copyrightLabel.Size = new System.Drawing.Size(248, 49); |
this.copyrightLabel.Size = new System.Drawing.Size(195, 13); |
this.copyrightLabel.TabIndex = 1; |
this.copyrightLabel.Text = "Copyright [copyright notice]"; |
this.copyrightLabel.UseMnemonic = false; |
this.copyrightLabel.Text = "Copyright (c) 2005-2006 Anatoli Klassen"; |
// |
// license1Label |
// |
this.license1Label.AutoSize = true; |
this.license1Label.Location = new System.Drawing.Point(32, 108); |
this.license1Label.Name = "license1Label"; |
this.license1Label.Size = new System.Drawing.Size(126, 13); |
this.license1Label.TabIndex = 2; |
this.license1Label.Text = "\"Public domain\" software"; |
// |
// 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.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right))); |
this.okButton.DialogResult = DialogResult.OK; |
this.okButton.Location = new System.Drawing.Point(205, 217); |
this.okButton.Name = "okButton"; |
this.okButton.Size = new System.Drawing.Size(75, 23); |
this.okButton.TabIndex = 3; |
56,56 → 78,63 |
// homePageLabel |
// |
this.homePageLabel.AutoSize = true; |
this.homePageLabel.Location = new System.Drawing.Point(32, 147); |
this.homePageLabel.Location = new System.Drawing.Point(32, 188); |
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); |
this.homePageLabel.LinkClicked += new LinkLabelLinkClickedEventHandler(this.homePageLabel_LinkClicked); |
// |
// versionLabel |
// |
this.versionLabel.AutoSize = true; |
this.versionLabel.Location = new System.Drawing.Point(32, 64); |
this.versionLabel.Location = new System.Drawing.Point(32, 76); |
this.versionLabel.Name = "versionLabel"; |
this.versionLabel.Size = new System.Drawing.Size(111, 13); |
this.versionLabel.Size = new System.Drawing.Size(60, 13); |
this.versionLabel.TabIndex = 5; |
this.versionLabel.Text = "Version [build number]"; |
this.versionLabel.UseMnemonic = false; |
this.versionLabel.Text = "Version 1.0"; |
// |
// appNameLabel |
// license2Label |
// |
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; |
this.license2Label.AutoSize = true; |
this.license2Label.Location = new System.Drawing.Point(32, 124); |
this.license2Label.Name = "license2Label"; |
this.license2Label.Size = new System.Drawing.Size(180, 13); |
this.license2Label.TabIndex = 6; |
this.license2Label.Text = "- you are allowed to use it in any way"; |
// |
// warrantyLabel |
// |
this.warrantyLabel.AutoSize = true; |
this.warrantyLabel.Location = new System.Drawing.Point(32, 156); |
this.warrantyLabel.Name = "warrantyLabel"; |
this.warrantyLabel.Size = new System.Drawing.Size(64, 13); |
this.warrantyLabel.TabIndex = 7; |
this.warrantyLabel.Text = "No warranty"; |
// |
// AboutForm |
// |
this.AcceptButton = this.okButton; |
this.CancelButton = this.okButton; |
this.ClientSize = new System.Drawing.Size(293, 207); |
this.Controls.Add(this.appNameLabel); |
this.ClientSize = new System.Drawing.Size(292, 252); |
this.Controls.Add(this.warrantyLabel); |
this.Controls.Add(this.license2Label); |
this.Controls.Add(this.versionLabel); |
this.Controls.Add(this.homePageLabel); |
this.Controls.Add(this.okButton); |
this.Controls.Add(this.license1Label); |
this.Controls.Add(this.copyrightLabel); |
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; |
this.Controls.Add(this.appLabel); |
this.FormBorderStyle = 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.StartPosition = FormStartPosition.CenterParent; |
this.Text = "About TCPproxy"; |
this.ResumeLayout(false); |
this.PerformLayout(); |
|
} |
|
#endregion |
128,35 → 157,5 |
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; |
} |
} |
} |