Click here to Skip to main content
15,879,326 members
Articles / Programming Languages / C#

Managed C++ wrapper for ZLib

Rate me:
Please Sign up or sign in to vote.
4.56/5 (14 votes)
3 Mar 2005CPOL9 min read 155K   5.7K   46  
.NET wrapper for ZLib, written in MC++
/*
DevelopDotNet
http://www.developdotnet.com

File Created by: Alberto Ferrazzoli
Date: 18/05/2004

Class Description:
About

Notes:

Revision Log - Please mark significant changes in source code in the following format:

Date  -  Time -  Reviewer  -  Comments

*/

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Reflection;

namespace ZTest
{
	/// <summary>
	/// Summary description for About.
	/// </summary>
	public class About : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Button btnOk;
		private System.Windows.Forms.LinkLabel linkDdn;
		private System.Windows.Forms.Label lblVersion;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.TextBox txtZLibInfo;
		private System.Windows.Forms.PictureBox pictureAboutBox;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public About()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			lblVersion.Text += " " + string.Join(".", Application.ProductVersion.Split(new char [] { '.' }), 0, 3);

			string sUrlEE = "http://www.developdotnet.com";
			linkDdn.Text = sUrlEE;
			linkDdn.Links.Add(0, linkDdn.Text.Length, sUrlEE);
			
			// Create an event handler for the LinkClicked event.
			linkDdn.LinkClicked += new LinkLabelLinkClickedEventHandler(LinkClicked);
			
			Assembly compressionLib = Assembly.GetAssembly(typeof(DevelopDotNet.Compression.ZLib));
			AssemblyName libName = compressionLib.GetName();
			
			txtZLibInfo.AppendText(libName.Name + " version " + libName.Version.ToString() + 
				Environment.NewLine + Environment.NewLine);
			txtZLibInfo.AppendText("ZLib Version: " + DevelopDotNet.Compression.ZLib.Version + Environment.NewLine);
			txtZLibInfo.AppendText("Compile Flags: " + DevelopDotNet.Compression.ZLib.CompileFlags.ToString());
		}

		protected void LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
		{
			LinkLabel lnk = sender as LinkLabel;

			// Determine which link was clicked within the LinkLabel.
			lnk.Links[lnk.Links.IndexOf(e.Link)].Visited = true;
			
			// Display the appropriate link based on the value of the LinkData property of the Link object.
			System.Diagnostics.Process.Start(e.Link.LinkData.ToString());
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#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()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(About));
			this.btnOk = new System.Windows.Forms.Button();
			this.linkDdn = new System.Windows.Forms.LinkLabel();
			this.lblVersion = new System.Windows.Forms.Label();
			this.label1 = new System.Windows.Forms.Label();
			this.txtZLibInfo = new System.Windows.Forms.TextBox();
			this.label2 = new System.Windows.Forms.Label();
			this.pictureAboutBox = new System.Windows.Forms.PictureBox();
			this.SuspendLayout();
			// 
			// btnOk
			// 
			this.btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
			this.btnOk.Location = new System.Drawing.Point(184, 192);
			this.btnOk.Name = "btnOk";
			this.btnOk.Size = new System.Drawing.Size(81, 23);
			this.btnOk.TabIndex = 0;
			this.btnOk.Text = "OK";
			this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
			// 
			// linkDdn
			// 
			this.linkDdn.Location = new System.Drawing.Point(8, 56);
			this.linkDdn.Name = "linkDdn";
			this.linkDdn.Size = new System.Drawing.Size(184, 16);
			this.linkDdn.TabIndex = 1;
			this.linkDdn.TabStop = true;
			this.linkDdn.Text = "DevelopDotnet";
			// 
			// lblVersion
			// 
			this.lblVersion.Location = new System.Drawing.Point(8, 32);
			this.lblVersion.Name = "lblVersion";
			this.lblVersion.Size = new System.Drawing.Size(104, 16);
			this.lblVersion.TabIndex = 2;
			this.lblVersion.Text = "Version ";
			// 
			// label1
			// 
			this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label1.Location = new System.Drawing.Point(8, 0);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(184, 23);
			this.label1.TabIndex = 3;
			this.label1.Text = "ZTest Compression";
			// 
			// txtZLibInfo
			// 
			this.txtZLibInfo.Location = new System.Drawing.Point(8, 96);
			this.txtZLibInfo.Multiline = true;
			this.txtZLibInfo.Name = "txtZLibInfo";
			this.txtZLibInfo.ReadOnly = true;
			this.txtZLibInfo.Size = new System.Drawing.Size(256, 80);
			this.txtZLibInfo.TabIndex = 4;
			this.txtZLibInfo.Text = "";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(8, 80);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(112, 16);
			this.label2.TabIndex = 5;
			this.label2.Text = "Info:";
			// 
			// pictureAboutBox
			// 
			this.pictureAboutBox.Image = ((System.Drawing.Image)(resources.GetObject("pictureAboutBox.Image")));
			this.pictureAboutBox.Location = new System.Drawing.Point(208, 8);
			this.pictureAboutBox.Name = "pictureAboutBox";
			this.pictureAboutBox.Size = new System.Drawing.Size(48, 48);
			this.pictureAboutBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
			this.pictureAboutBox.TabIndex = 6;
			this.pictureAboutBox.TabStop = false;
			// 
			// About
			// 
			this.AcceptButton = this.btnOk;
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(274, 223);
			this.Controls.Add(this.pictureAboutBox);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.txtZLibInfo);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.lblVersion);
			this.Controls.Add(this.linkDdn);
			this.Controls.Add(this.btnOk);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "About";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
			this.Text = "About";
			this.ResumeLayout(false);

		}
		#endregion

		private void btnOk_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Italy Italy
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions