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

namespace Project1
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		public System.Windows.Forms.GroupBox Frame1;
		public System.Windows.Forms.Button Command1;
		public System.Windows.Forms.Button Command2;
		public System.Windows.Forms.TextBox Text1;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		private short IntIndex;
		private AxIMAGEKIT7Lib.AxImageKit ImageKit1;
		private System.Windows.Forms.RadioButton radioButton1;
		private System.Windows.Forms.RadioButton radioButton2;
		private System.Windows.Forms.RadioButton radioButton3;
		private System.Windows.Forms.RadioButton radioButton4;
		private System.Windows.Forms.RadioButton radioButton5;
		private System.Windows.Forms.RadioButton radioButton6;
		private System.Windows.Forms.RadioButton radioButton7;
		private System.Windows.Forms.RadioButton radioButton8;
		private System.Windows.Forms.RadioButton radioButton9;
		private IMAGEKIT7Lib.LoadFileConstants ImageType;

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

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <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(Form1));
			this.Frame1 = new System.Windows.Forms.GroupBox();
			this.radioButton9 = new System.Windows.Forms.RadioButton();
			this.radioButton8 = new System.Windows.Forms.RadioButton();
			this.radioButton7 = new System.Windows.Forms.RadioButton();
			this.radioButton6 = new System.Windows.Forms.RadioButton();
			this.radioButton5 = new System.Windows.Forms.RadioButton();
			this.radioButton4 = new System.Windows.Forms.RadioButton();
			this.radioButton3 = new System.Windows.Forms.RadioButton();
			this.radioButton2 = new System.Windows.Forms.RadioButton();
			this.radioButton1 = new System.Windows.Forms.RadioButton();
			this.Command1 = new System.Windows.Forms.Button();
			this.Command2 = new System.Windows.Forms.Button();
			this.Text1 = new System.Windows.Forms.TextBox();
			this.ImageKit1 = new AxIMAGEKIT7Lib.AxImageKit();
			this.Frame1.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.ImageKit1)).BeginInit();
			this.SuspendLayout();
			// 
			// Frame1
			// 
			this.Frame1.BackColor = System.Drawing.SystemColors.Control;
			this.Frame1.Controls.Add(this.radioButton9);
			this.Frame1.Controls.Add(this.radioButton8);
			this.Frame1.Controls.Add(this.radioButton7);
			this.Frame1.Controls.Add(this.radioButton6);
			this.Frame1.Controls.Add(this.radioButton5);
			this.Frame1.Controls.Add(this.radioButton4);
			this.Frame1.Controls.Add(this.radioButton3);
			this.Frame1.Controls.Add(this.radioButton2);
			this.Frame1.Controls.Add(this.radioButton1);
			this.Frame1.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.Frame1.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Frame1.Location = new System.Drawing.Point(423, 67);
			this.Frame1.Name = "Frame1";
			this.Frame1.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Frame1.Size = new System.Drawing.Size(121, 181);
			this.Frame1.TabIndex = 17;
			this.Frame1.TabStop = false;
			this.Frame1.Text = "Some Image Types";
			// 
			// radioButton9
			// 
			this.radioButton9.Location = new System.Drawing.Point(16, 152);
			this.radioButton9.Name = "radioButton9";
			this.radioButton9.Size = new System.Drawing.Size(96, 16);
			this.radioButton9.TabIndex = 8;
			this.radioButton9.Text = "All Image Files";
			this.radioButton9.CheckedChanged += new System.EventHandler(this.radioButton9_CheckedChanged);
			// 
			// radioButton8
			// 
			this.radioButton8.Location = new System.Drawing.Point(16, 136);
			this.radioButton8.Name = "radioButton8";
			this.radioButton8.Size = new System.Drawing.Size(88, 16);
			this.radioButton8.TabIndex = 7;
			this.radioButton8.Text = "JPEG2000";
			this.radioButton8.CheckedChanged += new System.EventHandler(this.radioButton8_CheckedChanged);
			// 
			// radioButton7
			// 
			this.radioButton7.Location = new System.Drawing.Point(16, 120);
			this.radioButton7.Name = "radioButton7";
			this.radioButton7.Size = new System.Drawing.Size(88, 16);
			this.radioButton7.TabIndex = 6;
			this.radioButton7.Text = "WMF";
			this.radioButton7.CheckedChanged += new System.EventHandler(this.radioButton7_CheckedChanged);
			// 
			// radioButton6
			// 
			this.radioButton6.Location = new System.Drawing.Point(16, 104);
			this.radioButton6.Name = "radioButton6";
			this.radioButton6.Size = new System.Drawing.Size(88, 16);
			this.radioButton6.TabIndex = 5;
			this.radioButton6.Text = "EMF";
			this.radioButton6.CheckedChanged += new System.EventHandler(this.radioButton6_CheckedChanged);
			// 
			// radioButton5
			// 
			this.radioButton5.Location = new System.Drawing.Point(16, 88);
			this.radioButton5.Name = "radioButton5";
			this.radioButton5.Size = new System.Drawing.Size(88, 16);
			this.radioButton5.TabIndex = 4;
			this.radioButton5.Text = "TIFF";
			this.radioButton5.CheckedChanged += new System.EventHandler(this.radioButton5_CheckedChanged);
			// 
			// radioButton4
			// 
			this.radioButton4.Location = new System.Drawing.Point(16, 72);
			this.radioButton4.Name = "radioButton4";
			this.radioButton4.Size = new System.Drawing.Size(88, 16);
			this.radioButton4.TabIndex = 3;
			this.radioButton4.Text = "PNG";
			this.radioButton4.CheckedChanged += new System.EventHandler(this.radioButton4_CheckedChanged);
			// 
			// radioButton3
			// 
			this.radioButton3.Location = new System.Drawing.Point(16, 56);
			this.radioButton3.Name = "radioButton3";
			this.radioButton3.Size = new System.Drawing.Size(88, 16);
			this.radioButton3.TabIndex = 2;
			this.radioButton3.Text = "JPEG";
			this.radioButton3.CheckedChanged += new System.EventHandler(this.radioButton3_CheckedChanged);
			// 
			// radioButton2
			// 
			this.radioButton2.Location = new System.Drawing.Point(16, 40);
			this.radioButton2.Name = "radioButton2";
			this.radioButton2.Size = new System.Drawing.Size(88, 16);
			this.radioButton2.TabIndex = 1;
			this.radioButton2.Text = "Gif";
			this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged);
			// 
			// radioButton1
			// 
			this.radioButton1.Location = new System.Drawing.Point(16, 24);
			this.radioButton1.Name = "radioButton1";
			this.radioButton1.Size = new System.Drawing.Size(88, 16);
			this.radioButton1.TabIndex = 0;
			this.radioButton1.Text = "Bmp";
			this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged);
			// 
			// Command1
			// 
			this.Command1.BackColor = System.Drawing.SystemColors.Control;
			this.Command1.Cursor = System.Windows.Forms.Cursors.Default;
			this.Command1.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.Command1.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Command1.Location = new System.Drawing.Point(423, 283);
			this.Command1.Name = "Command1";
			this.Command1.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Command1.Size = new System.Drawing.Size(121, 33);
			this.Command1.TabIndex = 16;
			this.Command1.Text = "Load and Display";
			this.Command1.Click += new System.EventHandler(this.Command1_Click);
			// 
			// Command2
			// 
			this.Command2.BackColor = System.Drawing.SystemColors.Control;
			this.Command2.Cursor = System.Windows.Forms.Cursors.Default;
			this.Command2.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.Command2.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Command2.Location = new System.Drawing.Point(423, 363);
			this.Command2.Name = "Command2";
			this.Command2.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Command2.Size = new System.Drawing.Size(121, 33);
			this.Command2.TabIndex = 15;
			this.Command2.Text = "End";
			this.Command2.Click += new System.EventHandler(this.Command2_Click);
			// 
			// Text1
			// 
			this.Text1.AcceptsReturn = true;
			this.Text1.AutoSize = false;
			this.Text1.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(255)), ((System.Byte)(192)));
			this.Text1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.Text1.Cursor = System.Windows.Forms.Cursors.IBeam;
			this.Text1.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.Text1.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(64)), ((System.Byte)(0)));
			this.Text1.Location = new System.Drawing.Point(8, 0);
			this.Text1.MaxLength = 0;
			this.Text1.Multiline = true;
			this.Text1.Name = "Text1";
			this.Text1.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Text1.Size = new System.Drawing.Size(537, 49);
			this.Text1.TabIndex = 14;
			this.Text1.Text = "The ImageKit supports a variety of image formats. When loading an image, the Load" +
				"File method can automatically recognize and load all supported image formats or " +
				"you can set the method parameters to load only the image format of your choice.";
			// 
			// ImageKit1
			// 
			this.ImageKit1.Location = new System.Drawing.Point(8, 56);
			this.ImageKit1.Name = "ImageKit1";
			this.ImageKit1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("ImageKit1.OcxState")));
			this.ImageKit1.Size = new System.Drawing.Size(409, 345);
			this.ImageKit1.TabIndex = 27;
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(550, 407);
			this.Controls.Add(this.ImageKit1);
			this.Controls.Add(this.Frame1);
			this.Controls.Add(this.Command1);
			this.Controls.Add(this.Command2);
			this.Controls.Add(this.Text1);
			this.Name = "Form1";
			this.Text = "Loading Only Certain Image Types";
			this.Load += new System.EventHandler(this.Form1_Load);
			this.Frame1.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.ImageKit1)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}

		private void Command1_Click(object sender, System.EventArgs e)
		{
			bool ret = true;
			string ErrorMessage = "";
		
		
			//display the Open file dialog
			//and choose the image to be loaded...
			if (ImageKit1.File.OpenFileDialog() == false) 
			{
				return;
			}
		
			switch (IntIndex) 
			{

				case 0:
					ImageType = IMAGEKIT7Lib.LoadFileConstants.ikLoadBMP;
					ErrorMessage = "Please load a BMP image";
					break;
				case 1:
					ImageType = IMAGEKIT7Lib.LoadFileConstants.ikLoadGIF;
					ErrorMessage = "Please load a GIF image";
					break;
				case 2:
					ImageType = IMAGEKIT7Lib.LoadFileConstants.ikLoadJPEG;
					ErrorMessage = "Please load a JPEG image";
					break;
				case 3:
					ImageType = IMAGEKIT7Lib.LoadFileConstants.ikLoadPNG;
					ErrorMessage = "Please load a PNG image";
					break;
				case 4:
					ImageType = IMAGEKIT7Lib.LoadFileConstants.ikLoadTIFF;
					ErrorMessage = "Please load an Uncompressed TIFF image";
					break;
				case 5:
					ImageType = IMAGEKIT7Lib.LoadFileConstants.ikLoadEMF;
					ErrorMessage = "Please load a EMF image";
					break;
				case 6:
					ImageType = IMAGEKIT7Lib.LoadFileConstants.ikLoadWMF;
					ErrorMessage = "Please load a WMF image";
					break;
				case 7:
					ImageType = IMAGEKIT7Lib.LoadFileConstants.ikLoadJPEG2000;
					ErrorMessage = "Please load a JPEG2000 image";
					break;
				case 8:
					ImageType = IMAGEKIT7Lib.LoadFileConstants.ikLoad;
					ErrorMessage = "Unable to load image. Is that a supported image format?";
					break;
			}
		
		
		
			//load the image file...
			ret = ImageKit1.File.LoadFile(ImageType);
		
			if (ret == false) 
			{
				MessageBox.Show(ErrorMessage);
				return;
			}
		
			//display image in scale mode
			ImageKit1.Display(IMAGEKIT7Lib.DispModeConstants.ikScale);
		}

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

		private void radioButton1_CheckedChanged(object sender, System.EventArgs e)
		{
			IntIndex=0;
		}

		private void radioButton2_CheckedChanged(object sender, System.EventArgs e)
		{
			IntIndex=1;
		}

		private void radioButton3_CheckedChanged(object sender, System.EventArgs e)
		{
			IntIndex=2;
		}

		private void radioButton4_CheckedChanged(object sender, System.EventArgs e)
		{
			IntIndex=3;
		}

		private void radioButton5_CheckedChanged(object sender, System.EventArgs e)
		{
			IntIndex=4;
		}

		private void radioButton6_CheckedChanged(object sender, System.EventArgs e)
		{
			IntIndex=5;
		}

		private void radioButton7_CheckedChanged(object sender, System.EventArgs e)
		{
			IntIndex=6;
		}

		private void radioButton8_CheckedChanged(object sender, System.EventArgs e)
		{
			IntIndex=7;
		}

		private void radioButton9_CheckedChanged(object sender, System.EventArgs e)
		{
			IntIndex=8;
		}

		private void Form1_Load(object sender, System.EventArgs e)
		{
			radioButton9.Checked=true;
			IntIndex=8;
		}



	}
}
