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

namespace Project1
{
	/// <summary>
	///
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		private System.ComponentModel.IContainer components;
		public System.Windows.Forms.Button Command2;
		public System.Windows.Forms.PictureBox Picture2;
		public System.Windows.Forms.PictureBox Picture1;
		public System.Windows.Forms.Button Command6;
		public System.Windows.Forms.GroupBox Frame7;
		public System.Windows.Forms.Button Command5;
		public System.Windows.Forms.GroupBox Frame8;
		public System.Windows.Forms.CheckBox Check4;
		public System.Windows.Forms.CheckBox Check3;
		public System.Windows.Forms.CheckBox Check2;
		public System.Windows.Forms.CheckBox Check5;
		public System.Windows.Forms.TextBox Text3;
		public System.Windows.Forms.CheckBox Check1;
		public System.Windows.Forms.Label Label3;
		public System.Windows.Forms.GroupBox Frame6;
		public System.Windows.Forms.CheckBox Check7;
		public System.Windows.Forms.CheckBox Check6;
		public System.Windows.Forms.Button Command4;
		public System.Windows.Forms.TextBox Text2;
		public System.Windows.Forms.GroupBox Frame4;
		public System.Windows.Forms.CheckBox Check8;
		public System.Windows.Forms.Button Command1;
		public System.Windows.Forms.GroupBox Frame5;
		public System.Windows.Forms.Button Command8;
		public System.Windows.Forms.Button Command7;
		public System.Windows.Forms.GroupBox Frame3;
		public System.Windows.Forms.Button Command3;
		public System.Windows.Forms.RadioButton Option2_2;
		public System.Windows.Forms.RadioButton Option2_1;
		public System.Windows.Forms.RadioButton Option2_0;
		public System.Windows.Forms.RadioButton Option3_0;
		public System.Windows.Forms.RadioButton Option3_1;
		public System.Windows.Forms.RadioButton Option3_2;
		public System.Windows.Forms.RadioButton Option1_0;
		public System.Windows.Forms.RadioButton Option1_2;
		internal AxIMAGEKIT7Lib.AxImageKit ImageKit1;
		public System.Windows.Forms.RadioButton Option1_1;

		private Form2 ProgressForm;
		public short SaveType;
		public IMAGEKIT7Lib.UnitConstants Coordinate;
		public IMAGEKIT7Lib.DispModeConstants ShowMode;
		public System.Windows.Forms.TextBox Text1; 
		public string CurrentDir;


		public Form1()
		{
			//
			//
			//
			InitializeComponent();

			//
			// 
			//
		}

		/// <summary>
		///
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// デザイナ サポートに必要なメソッドです。このメソッドの内容を
		/// コード エディタで変更しないでください。
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
			this.Command2 = new System.Windows.Forms.Button();
			this.Picture2 = new System.Windows.Forms.PictureBox();
			this.Picture1 = new System.Windows.Forms.PictureBox();
			this.Command6 = new System.Windows.Forms.Button();
			this.Frame7 = new System.Windows.Forms.GroupBox();
			this.Option2_2 = new System.Windows.Forms.RadioButton();
			this.Option2_1 = new System.Windows.Forms.RadioButton();
			this.Option2_0 = new System.Windows.Forms.RadioButton();
			this.Command5 = new System.Windows.Forms.Button();
			this.Frame8 = new System.Windows.Forms.GroupBox();
			this.Check4 = new System.Windows.Forms.CheckBox();
			this.Check3 = new System.Windows.Forms.CheckBox();
			this.Check2 = new System.Windows.Forms.CheckBox();
			this.Check5 = new System.Windows.Forms.CheckBox();
			this.Text3 = new System.Windows.Forms.TextBox();
			this.Check1 = new System.Windows.Forms.CheckBox();
			this.Label3 = new System.Windows.Forms.Label();
			this.Frame6 = new System.Windows.Forms.GroupBox();
			this.Check7 = new System.Windows.Forms.CheckBox();
			this.Check6 = new System.Windows.Forms.CheckBox();
			this.Command4 = new System.Windows.Forms.Button();
			this.Text2 = new System.Windows.Forms.TextBox();
			this.Frame4 = new System.Windows.Forms.GroupBox();
			this.Check8 = new System.Windows.Forms.CheckBox();
			this.Option3_0 = new System.Windows.Forms.RadioButton();
			this.Option3_1 = new System.Windows.Forms.RadioButton();
			this.Option3_2 = new System.Windows.Forms.RadioButton();
			this.Command1 = new System.Windows.Forms.Button();
			this.Frame5 = new System.Windows.Forms.GroupBox();
			this.Command8 = new System.Windows.Forms.Button();
			this.Command7 = new System.Windows.Forms.Button();
			this.Frame3 = new System.Windows.Forms.GroupBox();
			this.Option1_0 = new System.Windows.Forms.RadioButton();
			this.Option1_2 = new System.Windows.Forms.RadioButton();
			this.Option1_1 = new System.Windows.Forms.RadioButton();
			this.Command3 = new System.Windows.Forms.Button();
			this.ImageKit1 = new AxIMAGEKIT7Lib.AxImageKit();
			this.Text1 = new System.Windows.Forms.TextBox();
			this.Frame7.SuspendLayout();
			this.Frame8.SuspendLayout();
			this.Frame6.SuspendLayout();
			this.Frame4.SuspendLayout();
			this.Frame5.SuspendLayout();
			this.Frame3.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.ImageKit1)).BeginInit();
			this.SuspendLayout();
			// 
			// Command2
			// 
			this.Command2.BackColor = System.Drawing.SystemColors.Control;
			this.Command2.Cursor = System.Windows.Forms.Cursors.Default;
			this.Command2.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Command2.Location = new System.Drawing.Point(476, 156);
			this.Command2.Name = "Command2";
			this.Command2.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Command2.Size = new System.Drawing.Size(97, 39);
			this.Command2.TabIndex = 41;
			this.Command2.Text = "Save Image";
			this.Command2.Click += new System.EventHandler(this.Command2_Click);
			// 
			// Picture2
			// 
			this.Picture2.BackColor = System.Drawing.SystemColors.Control;
			this.Picture2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.Picture2.Cursor = System.Windows.Forms.Cursors.Default;
			this.Picture2.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Picture2.Location = new System.Drawing.Point(232, 564);
			this.Picture2.Name = "Picture2";
			this.Picture2.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Picture2.Size = new System.Drawing.Size(217, 139);
			this.Picture2.TabIndex = 38;
			this.Picture2.TabStop = false;
			// 
			// Picture1
			// 
			this.Picture1.BackColor = System.Drawing.SystemColors.Control;
			this.Picture1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.Picture1.Cursor = System.Windows.Forms.Cursors.Default;
			this.Picture1.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Picture1.Image = ((System.Drawing.Image)(resources.GetObject("Picture1.Image")));
			this.Picture1.Location = new System.Drawing.Point(8, 564);
			this.Picture1.Name = "Picture1";
			this.Picture1.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Picture1.Size = new System.Drawing.Size(217, 139);
			this.Picture1.TabIndex = 37;
			this.Picture1.TabStop = false;
			// 
			// Command6
			// 
			this.Command6.BackColor = System.Drawing.SystemColors.Control;
			this.Command6.Cursor = System.Windows.Forms.Cursors.Default;
			this.Command6.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Command6.Location = new System.Drawing.Point(232, 528);
			this.Command6.Name = "Command6";
			this.Command6.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Command6.Size = new System.Drawing.Size(217, 27);
			this.Command6.TabIndex = 43;
			this.Command6.Text = "IkDisp1.ImgHandle → Picture2.Picture";
			this.Command6.Click += new System.EventHandler(this.Command6_Click);
			// 
			// Frame7
			// 
			this.Frame7.BackColor = System.Drawing.SystemColors.Control;
			this.Frame7.Controls.Add(this.Option2_2);
			this.Frame7.Controls.Add(this.Option2_1);
			this.Frame7.Controls.Add(this.Option2_0);
			this.Frame7.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Frame7.Location = new System.Drawing.Point(264, 380);
			this.Frame7.Name = "Frame7";
			this.Frame7.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Frame7.Size = new System.Drawing.Size(201, 53);
			this.Frame7.TabIndex = 36;
			this.Frame7.TabStop = false;
			this.Frame7.Text = "Units of Measurement";
			// 
			// Option2_2
			// 
			this.Option2_2.BackColor = System.Drawing.SystemColors.Control;
			this.Option2_2.Cursor = System.Windows.Forms.Cursors.Default;
			this.Option2_2.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Option2_2.Location = new System.Drawing.Point(136, 26);
			this.Option2_2.Name = "Option2_2";
			this.Option2_2.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Option2_2.Size = new System.Drawing.Size(57, 18);
			this.Option2_2.TabIndex = 36;
			this.Option2_2.TabStop = true;
			this.Option2_2.Text = "Inch";
			this.Option2_2.Click += new System.EventHandler(this.Option2_2_Click);
			// 
			// Option2_1
			// 
			this.Option2_1.BackColor = System.Drawing.SystemColors.Control;
			this.Option2_1.Cursor = System.Windows.Forms.Cursors.Default;
			this.Option2_1.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Option2_1.Location = new System.Drawing.Point(72, 26);
			this.Option2_1.Name = "Option2_1";
			this.Option2_1.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Option2_1.Size = new System.Drawing.Size(57, 18);
			this.Option2_1.TabIndex = 35;
			this.Option2_1.TabStop = true;
			this.Option2_1.Text = "mm";
			this.Option2_1.Click += new System.EventHandler(this.Option2_1_Click);
			// 
			// Option2_0
			// 
			this.Option2_0.BackColor = System.Drawing.SystemColors.Control;
			this.Option2_0.Cursor = System.Windows.Forms.Cursors.Default;
			this.Option2_0.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Option2_0.Location = new System.Drawing.Point(8, 26);
			this.Option2_0.Name = "Option2_0";
			this.Option2_0.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Option2_0.Size = new System.Drawing.Size(57, 18);
			this.Option2_0.TabIndex = 34;
			this.Option2_0.TabStop = true;
			this.Option2_0.Text = "Pixel";
			this.Option2_0.Click += new System.EventHandler(this.Option2_0_Click);
			// 
			// Command5
			// 
			this.Command5.BackColor = System.Drawing.SystemColors.Control;
			this.Command5.Cursor = System.Windows.Forms.Cursors.Default;
			this.Command5.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Command5.Location = new System.Drawing.Point(8, 528);
			this.Command5.Name = "Command5";
			this.Command5.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Command5.Size = new System.Drawing.Size(217, 27);
			this.Command5.TabIndex = 42;
			this.Command5.Text = "Picture1.Picture → IkDisp1.ImgHandle";
			this.Command5.Click += new System.EventHandler(this.Command5_Click);
			// 
			// Frame8
			// 
			this.Frame8.BackColor = System.Drawing.SystemColors.Control;
			this.Frame8.Controls.Add(this.Check4);
			this.Frame8.Controls.Add(this.Check3);
			this.Frame8.Controls.Add(this.Check2);
			this.Frame8.Controls.Add(this.Check5);
			this.Frame8.Controls.Add(this.Text3);
			this.Frame8.Controls.Add(this.Check1);
			this.Frame8.Controls.Add(this.Label3);
			this.Frame8.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Frame8.Location = new System.Drawing.Point(8, 440);
			this.Frame8.Name = "Frame8";
			this.Frame8.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Frame8.Size = new System.Drawing.Size(377, 71);
			this.Frame8.TabIndex = 39;
			this.Frame8.TabStop = false;
			this.Frame8.Text = "Display";
			// 
			// Check4
			// 
			this.Check4.BackColor = System.Drawing.SystemColors.Control;
			this.Check4.Cursor = System.Windows.Forms.Cursors.Default;
			this.Check4.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Check4.Location = new System.Drawing.Point(8, 43);
			this.Check4.Name = "Check4";
			this.Check4.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Check4.Size = new System.Drawing.Size(88, 19);
			this.Check4.TabIndex = 31;
			this.Check4.Text = "Graduation";
			this.Check4.Click += new System.EventHandler(this.Check4_Click);
			// 
			// Check3
			// 
			this.Check3.BackColor = System.Drawing.SystemColors.Control;
			this.Check3.Cursor = System.Windows.Forms.Cursors.Default;
			this.Check3.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Check3.Location = new System.Drawing.Point(232, 17);
			this.Check3.Name = "Check3";
			this.Check3.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Check3.Size = new System.Drawing.Size(121, 19);
			this.Check3.TabIndex = 30;
			this.Check3.Text = "Drag Scroll";
			this.Check3.Click += new System.EventHandler(this.Check3_Click);
			// 
			// Check2
			// 
			this.Check2.BackColor = System.Drawing.SystemColors.Control;
			this.Check2.Cursor = System.Windows.Forms.Cursors.Default;
			this.Check2.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Check2.Location = new System.Drawing.Point(120, 17);
			this.Check2.Name = "Check2";
			this.Check2.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Check2.Size = new System.Drawing.Size(73, 19);
			this.Check2.TabIndex = 29;
			this.Check2.Text = "Coordinates";
			this.Check2.Click += new System.EventHandler(this.Check2_Click);
			// 
			// Check5
			// 
			this.Check5.BackColor = System.Drawing.SystemColors.Control;
			this.Check5.Cursor = System.Windows.Forms.Cursors.Default;
			this.Check5.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Check5.Location = new System.Drawing.Point(120, 43);
			this.Check5.Name = "Check5";
			this.Check5.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Check5.Size = new System.Drawing.Size(97, 19);
			this.Check5.TabIndex = 21;
			this.Check5.Text = "Grid";
			this.Check5.Click += new System.EventHandler(this.Check5_Click);
			// 
			// Text3
			// 
			this.Text3.AcceptsReturn = true;
			this.Text3.AutoSize = false;
			this.Text3.BackColor = System.Drawing.SystemColors.Window;
			this.Text3.Cursor = System.Windows.Forms.Cursors.IBeam;
			this.Text3.ForeColor = System.Drawing.SystemColors.WindowText;
			this.Text3.Location = new System.Drawing.Point(304, 43);
			this.Text3.MaxLength = 0;
			this.Text3.Name = "Text3";
			this.Text3.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Text3.Size = new System.Drawing.Size(57, 20);
			this.Text3.TabIndex = 20;
			this.Text3.Text = "10";
			this.Text3.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Text3_KeyDown);
			// 
			// Check1
			// 
			this.Check1.BackColor = System.Drawing.SystemColors.Control;
			this.Check1.Cursor = System.Windows.Forms.Cursors.Default;
			this.Check1.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Check1.Location = new System.Drawing.Point(8, 17);
			this.Check1.Name = "Check1";
			this.Check1.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Check1.Size = new System.Drawing.Size(105, 19);
			this.Check1.TabIndex = 19;
			this.Check1.Text = "Scroll Bars";
			this.Check1.Click += new System.EventHandler(this.Check1_Click);
			// 
			// Label3
			// 
			this.Label3.AutoSize = true;
			this.Label3.BackColor = System.Drawing.SystemColors.Control;
			this.Label3.Cursor = System.Windows.Forms.Cursors.Default;
			this.Label3.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Label3.Location = new System.Drawing.Point(232, 43);
			this.Label3.Name = "Label3";
			this.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Label3.Size = new System.Drawing.Size(58, 16);
			this.Label3.TabIndex = 22;
			this.Label3.Text = "Grid Width";
			// 
			// Frame6
			// 
			this.Frame6.BackColor = System.Drawing.SystemColors.Control;
			this.Frame6.Controls.Add(this.Check7);
			this.Frame6.Controls.Add(this.Check6);
			this.Frame6.Controls.Add(this.Command4);
			this.Frame6.Controls.Add(this.Text2);
			this.Frame6.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Frame6.Location = new System.Drawing.Point(456, 528);
			this.Frame6.Name = "Frame6";
			this.Frame6.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Frame6.Size = new System.Drawing.Size(121, 174);
			this.Frame6.TabIndex = 35;
			this.Frame6.TabStop = false;
			this.Frame6.Text = "Pan Window";
			// 
			// Check7
			// 
			this.Check7.BackColor = System.Drawing.SystemColors.Control;
			this.Check7.Cursor = System.Windows.Forms.Cursors.Default;
			this.Check7.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Check7.Location = new System.Drawing.Point(16, 52);
			this.Check7.Name = "Check7";
			this.Check7.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Check7.Size = new System.Drawing.Size(92, 18);
			this.Check7.TabIndex = 33;
			this.Check7.Text = "Close Button";
			this.Check7.Click += new System.EventHandler(this.Check7_Click);
			// 
			// Check6
			// 
			this.Check6.BackColor = System.Drawing.SystemColors.Control;
			this.Check6.Cursor = System.Windows.Forms.Cursors.Default;
			this.Check6.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Check6.Location = new System.Drawing.Point(16, 26);
			this.Check6.Name = "Check6";
			this.Check6.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Check6.Size = new System.Drawing.Size(81, 18);
			this.Check6.TabIndex = 32;
			this.Check6.Text = "Display";
			this.Check6.Click += new System.EventHandler(this.Check6_Click);
			// 
			// Command4
			// 
			this.Command4.BackColor = System.Drawing.SystemColors.Control;
			this.Command4.Cursor = System.Windows.Forms.Cursors.Default;
			this.Command4.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Command4.Location = new System.Drawing.Point(8, 87);
			this.Command4.Name = "Command4";
			this.Command4.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Command4.Size = new System.Drawing.Size(97, 30);
			this.Command4.TabIndex = 25;
			this.Command4.Text = "Caption";
			this.Command4.Click += new System.EventHandler(this.Command4_Click);
			// 
			// Text2
			// 
			this.Text2.AcceptsReturn = true;
			this.Text2.AutoSize = false;
			this.Text2.BackColor = System.Drawing.SystemColors.Window;
			this.Text2.Cursor = System.Windows.Forms.Cursors.IBeam;
			this.Text2.ForeColor = System.Drawing.SystemColors.WindowText;
			this.Text2.Location = new System.Drawing.Point(8, 130);
			this.Text2.MaxLength = 0;
			this.Text2.Name = "Text2";
			this.Text2.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Text2.Size = new System.Drawing.Size(97, 27);
			this.Text2.TabIndex = 14;
			this.Text2.Tag = "Text2";
			this.Text2.Text = "PanWindow";
			// 
			// Frame4
			// 
			this.Frame4.BackColor = System.Drawing.SystemColors.Control;
			this.Frame4.Controls.Add(this.Check8);
			this.Frame4.Controls.Add(this.Option3_0);
			this.Frame4.Controls.Add(this.Option3_1);
			this.Frame4.Controls.Add(this.Option3_2);
			this.Frame4.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Frame4.Location = new System.Drawing.Point(392, 440);
			this.Frame4.Name = "Frame4";
			this.Frame4.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Frame4.Size = new System.Drawing.Size(185, 71);
			this.Frame4.TabIndex = 31;
			this.Frame4.TabStop = false;
			this.Frame4.Text = "Display Style";
			// 
			// Check8
			// 
			this.Check8.BackColor = System.Drawing.SystemColors.Control;
			this.Check8.Cursor = System.Windows.Forms.Cursors.Default;
			this.Check8.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Check8.Location = new System.Drawing.Point(16, 35);
			this.Check8.Name = "Check8";
			this.Check8.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Check8.Size = new System.Drawing.Size(64, 18);
			this.Check8.TabIndex = 38;
			this.Check8.Text = "Display";
			this.Check8.Click += new System.EventHandler(this.Check8_Click);
			// 
			// Option3_0
			// 
			this.Option3_0.BackColor = System.Drawing.SystemColors.Control;
			this.Option3_0.Cursor = System.Windows.Forms.Cursors.Default;
			this.Option3_0.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Option3_0.Location = new System.Drawing.Point(100, 13);
			this.Option3_0.Name = "Option3_0";
			this.Option3_0.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Option3_0.Size = new System.Drawing.Size(80, 18);
			this.Option3_0.TabIndex = 2;
			this.Option3_0.TabStop = true;
			this.Option3_0.Text = "Flat";
			this.Option3_0.Click += new System.EventHandler(this.Option3_0_Click);
			// 
			// Option3_1
			// 
			this.Option3_1.BackColor = System.Drawing.SystemColors.Control;
			this.Option3_1.Cursor = System.Windows.Forms.Cursors.Default;
			this.Option3_1.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Option3_1.Location = new System.Drawing.Point(100, 30);
			this.Option3_1.Name = "Option3_1";
			this.Option3_1.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Option3_1.Size = new System.Drawing.Size(76, 19);
			this.Option3_1.TabIndex = 3;
			this.Option3_1.TabStop = true;
			this.Option3_1.Text = "Lowered";
			this.Option3_1.Click += new System.EventHandler(this.Option3_1_Click);
			// 
			// Option3_2
			// 
			this.Option3_2.BackColor = System.Drawing.SystemColors.Control;
			this.Option3_2.Cursor = System.Windows.Forms.Cursors.Default;
			this.Option3_2.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Option3_2.Location = new System.Drawing.Point(100, 48);
			this.Option3_2.Name = "Option3_2";
			this.Option3_2.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Option3_2.Size = new System.Drawing.Size(68, 18);
			this.Option3_2.TabIndex = 9;
			this.Option3_2.TabStop = true;
			this.Option3_2.Text = "Raised";
			this.Option3_2.Click += new System.EventHandler(this.Option3_2_Click);
			// 
			// Command1
			// 
			this.Command1.BackColor = System.Drawing.SystemColors.Control;
			this.Command1.Cursor = System.Windows.Forms.Cursors.Default;
			this.Command1.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Command1.Location = new System.Drawing.Point(476, 112);
			this.Command1.Name = "Command1";
			this.Command1.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Command1.Size = new System.Drawing.Size(97, 36);
			this.Command1.TabIndex = 28;
			this.Command1.Text = "Load Image";
			this.Command1.Click += new System.EventHandler(this.Command1_Click);
			// 
			// Frame5
			// 
			this.Frame5.BackColor = System.Drawing.SystemColors.Control;
			this.Frame5.Controls.Add(this.Command8);
			this.Frame5.Controls.Add(this.Command7);
			this.Frame5.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Frame5.Location = new System.Drawing.Point(480, 320);
			this.Frame5.Name = "Frame5";
			this.Frame5.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Frame5.Size = new System.Drawing.Size(97, 114);
			this.Frame5.TabIndex = 34;
			this.Frame5.TabStop = false;
			this.Frame5.Text = "Edit";
			// 
			// Command8
			// 
			this.Command8.BackColor = System.Drawing.SystemColors.Control;
			this.Command8.Cursor = System.Windows.Forms.Cursors.Default;
			this.Command8.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Command8.Location = new System.Drawing.Point(8, 69);
			this.Command8.Name = "Command8";
			this.Command8.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Command8.Size = new System.Drawing.Size(81, 27);
			this.Command8.TabIndex = 37;
			this.Command8.Text = "UpdateImage";
			this.Command8.Click += new System.EventHandler(this.Command8_Click);
			// 
			// Command7
			// 
			this.Command7.BackColor = System.Drawing.SystemColors.Control;
			this.Command7.Cursor = System.Windows.Forms.Cursors.Default;
			this.Command7.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Command7.Location = new System.Drawing.Point(8, 35);
			this.Command7.Name = "Command7";
			this.Command7.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Command7.Size = new System.Drawing.Size(84, 27);
			this.Command7.TabIndex = 28;
			this.Command7.Text = "EnableEditing";
			this.Command7.Click += new System.EventHandler(this.Command7_Click);
			// 
			// Frame3
			// 
			this.Frame3.BackColor = System.Drawing.SystemColors.Control;
			this.Frame3.Controls.Add(this.Option1_0);
			this.Frame3.Controls.Add(this.Option1_2);
			this.Frame3.Controls.Add(this.Option1_1);
			this.Frame3.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Frame3.Location = new System.Drawing.Point(8, 380);
			this.Frame3.Name = "Frame3";
			this.Frame3.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Frame3.Size = new System.Drawing.Size(249, 53);
			this.Frame3.TabIndex = 30;
			this.Frame3.TabStop = false;
			this.Frame3.Text = "Display Mode";
			// 
			// Option1_0
			// 
			this.Option1_0.BackColor = System.Drawing.SystemColors.Control;
			this.Option1_0.Cursor = System.Windows.Forms.Cursors.Default;
			this.Option1_0.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Option1_0.Location = new System.Drawing.Point(8, 26);
			this.Option1_0.Name = "Option1_0";
			this.Option1_0.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Option1_0.Size = new System.Drawing.Size(64, 18);
			this.Option1_0.TabIndex = 7;
			this.Option1_0.TabStop = true;
			this.Option1_0.Text = "Scale";
			this.Option1_0.Click += new System.EventHandler(this.Option1_0_Click);
			// 
			// Option1_2
			// 
			this.Option1_2.BackColor = System.Drawing.SystemColors.Control;
			this.Option1_2.Cursor = System.Windows.Forms.Cursors.Default;
			this.Option1_2.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Option1_2.Location = new System.Drawing.Point(160, 26);
			this.Option1_2.Name = "Option1_2";
			this.Option1_2.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Option1_2.Size = new System.Drawing.Size(84, 18);
			this.Option1_2.TabIndex = 6;
			this.Option1_2.TabStop = true;
			this.Option1_2.Text = "Actual Size";
			this.Option1_2.Click += new System.EventHandler(this.Option1_2_Click);
			// 
			// Option1_1
			// 
			this.Option1_1.BackColor = System.Drawing.SystemColors.Control;
			this.Option1_1.Cursor = System.Windows.Forms.Cursors.Default;
			this.Option1_1.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Option1_1.Location = new System.Drawing.Point(80, 26);
			this.Option1_1.Name = "Option1_1";
			this.Option1_1.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Option1_1.Size = new System.Drawing.Size(64, 18);
			this.Option1_1.TabIndex = 5;
			this.Option1_1.TabStop = true;
			this.Option1_1.Text = "Stretch";
			this.Option1_1.Click += new System.EventHandler(this.Option1_1_Click);
			// 
			// Command3
			// 
			this.Command3.BackColor = System.Drawing.SystemColors.Control;
			this.Command3.Cursor = System.Windows.Forms.Cursors.Default;
			this.Command3.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Command3.Location = new System.Drawing.Point(476, 216);
			this.Command3.Name = "Command3";
			this.Command3.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Command3.Size = new System.Drawing.Size(97, 36);
			this.Command3.TabIndex = 29;
			this.Command3.Text = "End";
			this.Command3.Click += new System.EventHandler(this.Command3_Click);
			// 
			// ImageKit1
			// 
			this.ImageKit1.Location = new System.Drawing.Point(16, 68);
			this.ImageKit1.Name = "ImageKit1";
			this.ImageKit1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("ImageKit1.OcxState")));
			this.ImageKit1.Size = new System.Drawing.Size(440, 308);
			this.ImageKit1.TabIndex = 44;
			this.ImageKit1.GetDragDropFileName += new AxIMAGEKIT7Lib._IImageKitEvents_GetDragDropFileNameEventHandler(this.ImageKit1_GetDragDropFileName);
			this.ImageKit1.Progress += new AxIMAGEKIT7Lib._IImageKitEvents_ProgressEventHandler(this.ImageKit1_Progress);
			// 
			// 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.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)(0)), ((System.Byte)(0)));
			this.Text1.Location = new System.Drawing.Point(4, 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(569, 65);
			this.Text1.TabIndex = 45;
			this.Text1.Text = @"This sample illustrates a variety of ImageKit functions including the Image-Editing Toolbars. Load an image and click the ""Enable Editing"" button to display the toolbar. Once you have made changes to the image, transfer those changes to the image data by clicking the ""Update Image"" button. This sample also illustrates an alternative way to use the ""Save As"" dialog to save images.";
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(580, 710);
			this.Controls.Add(this.Text1);
			this.Controls.Add(this.ImageKit1);
			this.Controls.Add(this.Command2);
			this.Controls.Add(this.Picture2);
			this.Controls.Add(this.Picture1);
			this.Controls.Add(this.Command6);
			this.Controls.Add(this.Frame7);
			this.Controls.Add(this.Command5);
			this.Controls.Add(this.Frame8);
			this.Controls.Add(this.Frame6);
			this.Controls.Add(this.Frame4);
			this.Controls.Add(this.Command1);
			this.Controls.Add(this.Frame5);
			this.Controls.Add(this.Frame3);
			this.Controls.Add(this.Command3);
			this.Name = "Form1";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "Form1";
			this.Load += new System.EventHandler(this.Form1_Load);
			this.Closed += new System.EventHandler(this.Form1_Closed);
			this.Frame7.ResumeLayout(false);
			this.Frame8.ResumeLayout(false);
			this.Frame6.ResumeLayout(false);
			this.Frame4.ResumeLayout(false);
			this.Frame5.ResumeLayout(false);
			this.Frame3.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.ImageKit1)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// 
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}

		private void Form1_Load(object sender, System.EventArgs e)
		{
		
			Coordinate = IMAGEKIT7Lib.UnitConstants.ikPixel;
			ShowMode = IMAGEKIT7Lib.DispModeConstants.ikScale;
		
			Option1_0.Checked = true; //display mode
			Option2_0.Checked = true; //units 
		
			CurrentDir = Directory.GetCurrentDirectory() + "\\";	
			ProgressForm = new Form2();
		}

		//load images
		private void Command1_Click(object sender, System.EventArgs e)
		{
			if (ImageKit1.Edit.EditStatus != false)
			{
				if (MessageBox.Show("You are editing. Are you sure you want to load an image?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No)
					return;
			}
		
			if (ImageKit1.File.OpenFileDialog() == false) 
				return;
		
			ProgressForm.Show();
			ImageKit1.File.LoadFile(IMAGEKIT7Lib.LoadFileConstants.ikLoad);
			ProgressForm.Hide();
		
			ImageKit1.Display(ShowMode);
		}

		//save image
		private void Command2_Click(object sender, System.EventArgs e)
		{
			if (ImageKit1.ImageHandle == 0 || ImageKit1.ImageKind == IMAGEKIT7Lib.ImageKindConstants.ikErrorImage)
				return;
		
			if (ImageKit1.File.SaveFileDialog() == false) return;
		
			SaveType = -1;
		
			//save raster image
			if (ImageKit1.ImageKind == IMAGEKIT7Lib.ImageKindConstants.ikRasterImage)
			{
				Form3 RasterForm = new Form3();
				DialogResult result = RasterForm.ShowDialog();
				if (result == DialogResult.OK)
				{
					SaveType = (short)RasterForm.SaveType;
					ImageKit1.File.JpegQuality = RasterForm.JpegQuality;
					ImageKit1.File.JpegSubsamp = RasterForm.JpegSubsamp;
					ImageKit1.File.Interlace = RasterForm.Interlace;
					ImageKit1.File.Transparent = RasterForm.Transparent;
					ImageKit1.File.GifAnime = RasterForm.GifAnime;
					ImageKit1.File.GifAnimeDelay = RasterForm.GifAnimeDelay;
					ImageKit1.File.TiffColorSpace = RasterForm.TiffColorSpace;
					ImageKit1.File.PalBlue = RasterForm.PalBlue; 
					ImageKit1.File.PalGreen = RasterForm.PalGreen; 
					ImageKit1.File.PalRed = RasterForm.PalRed; 
					RasterForm.Dispose();
				} 
				else 
				{
					RasterForm.Dispose();
					return;
				}

			}
			else
			// save vector image
			{
			
				Form4 VectorForm = new Form4();

				DialogResult result = VectorForm.ShowDialog();
				if (result == DialogResult.OK)
				{
					SaveType = (short)VectorForm.SaveType;
					VectorForm.Dispose();
				} 
				else 
				{
					VectorForm.Dispose();
					return;
				}
			}
		
			if (SaveType >= 0)
			{
				bool Ret;
				ProgressForm.Show();
				Ret = ImageKit1.File.SaveFile((IMAGEKIT7Lib.SaveFileConstants)SaveType, 0);
				ProgressForm.Hide();
				if (Ret == false) 
				{
					string Err = "(ErrorStatus = " + ImageKit1.ErrorStatus.ToString() + ")";
					MessageBox.Show("Failed to save" + Err, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}		
		}

		//picture1 → ImageKit
		private void Command5_Click(object sender, System.EventArgs e)
		{
			if (ImageKit1.Edit.EditStatus)
			{
				if (MessageBox.Show("You are editing. Are you sure you want to load an image?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No)
					return;
			}
		
			ImageKit1.Picture = Picture1.Image;
			ImageKit1.Display(ShowMode);		
		}

		//ImageKit → picture2
		private void Command6_Click(object sender, System.EventArgs e)
		{
			Picture2.Image = ImageKit1.Picture;		
		}

		//edit enable
		private void Command7_Click(object sender, System.EventArgs e)
		{
			if (ImageKit1.ImageHandle == 0 || ImageKit1.ImageKind == IMAGEKIT7Lib.ImageKindConstants.ikErrorImage)
				return;

			ImageKit1.Edit.EditEnable = true;	//enable editing

			if (ImageKit1.ImageKind == IMAGEKIT7Lib.ImageKindConstants.ikRasterImage)
			{
				ImageKit1.Edit.ToolBarTop = 50; // set the display position of the Image editing toolbar
				ImageKit1.Edit.ToolBarLeft = 100;
				ImageKit1.Edit.ToolBarLeft = 100;
				ImageKit1.Edit.ToolBarCloseBox = true; // set the close button for the image editing toolbar
				ImageKit1.Edit.ToolBarCaption = "ToolBar"; // set the caption for the image editing toolbar

				ImageKit1.Edit.AirBrushSize5 = 50; // set the 5th step for the size of the airbrush
				ImageKit1.Edit.ForeColor = Convert.ToUInt32(0xFF); // foreground color
				ImageKit1.Edit.BackColor = Convert.ToUInt32(0xFFC0FF); // background color
				ImageKit1.Edit.FontName = "Arial"; // set the font
				ImageKit1.Edit.FontBold = true;
				ImageKit1.Edit.FontItalic = true;
				ImageKit1.Edit.FontSize = 36;
				ImageKit1.Edit.FontStrikeOut = true;
				ImageKit1.Edit.FontUnderline = true;
				ImageKit1.Edit.StampBmpFile = CurrentDir + "Stamp.bmp"; // set the stamp bitmap
			
				ImageKit1.Edit.ShowToolBar(IMAGEKIT7Lib.EditToolBarModeConstants.ikRaster); // display image editing toolbar
			}
			else		
				ImageKit1.Edit.ShowToolBar(IMAGEKIT7Lib.EditToolBarModeConstants.ikVector);
		}

		//update edit
		private void Command8_Click(object sender, System.EventArgs e)
		{
			ImageKit1.Edit.Modify();
			ImageKit1.Edit.ShowToolBar(IMAGEKIT7Lib.EditToolBarModeConstants.ikHide); // hide image editing toolbar		
		}

		private void ImageKit1_GetDragDropFileName(object sender, AxIMAGEKIT7Lib._IImageKitEvents_GetDragDropFileNameEvent e)
		{
			ProgressForm.Show();
			ImageKit1.File.FileName = e.fileName; // file name of drop image
			ImageKit1.File.LoadPage = e.page; // number of pages of drop image
			ImageKit1.File.LoadFile(IMAGEKIT7Lib.LoadFileConstants.ikLoad);
			ProgressForm.Hide();
		
			ImageKit1.Display(ShowMode);
		}

		private void ImageKit1_Progress(object sender, AxIMAGEKIT7Lib._IImageKitEvents_ProgressEvent e)
		{
			ProgressForm.progressBar1.Value = e.percent;
			Application.DoEvents();

			if (ProgressForm.CancelFlag == true)
				ImageKit1.File.Cancel = true;
			else
				ImageKit1.File.Cancel = false;		
		}

		//display - scale
		private void Option1_0_Click(object sender, System.EventArgs e)
		{
			ShowMode = IMAGEKIT7Lib.DispModeConstants.ikScale;
			ImageKit1.Display(ShowMode);		
		}

		//display - stretch
		private void Option1_1_Click(object sender, System.EventArgs e)
		{
			ShowMode = IMAGEKIT7Lib.DispModeConstants.ikStretch;
			ImageKit1.Display(ShowMode);		
		}

		//display - actual size
		private void Option1_2_Click(object sender, System.EventArgs e)
		{
			ShowMode = IMAGEKIT7Lib.DispModeConstants.ikActualSize;
			ImageKit1.Display(ShowMode);
		}

		private void Option2_0_Click(object sender, System.EventArgs e)
		{
			Coordinate = IMAGEKIT7Lib.UnitConstants.ikPixel;		
			Show_Grad();
			Show_Grid();
			Show_ToolTip();
		}

		private void Option2_1_Click(object sender, System.EventArgs e)
		{
			Coordinate = IMAGEKIT7Lib.UnitConstants.ikmm;		
			Show_Grad();
			Show_Grid();
			Show_ToolTip();
		}

		private void Option2_2_Click(object sender, System.EventArgs e)
		{
			Coordinate = IMAGEKIT7Lib.UnitConstants.ikInch;
			Show_Grad();
			Show_Grid();
			Show_ToolTip();
		}

		private void Text3_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if (e.KeyCode == Keys.Enter)
			{
				ImageKit1.GridSpace = Convert.ToDouble(Text3.Text);
				ImageKit1.Display(ShowMode);
			}
		}

		//show border
		private void Check8_Click(object sender, System.EventArgs e)
		{
			ImageKit1.BorderVisible = Check8.Checked;
		}

		//border - flat
		private void Option3_0_Click(object sender, System.EventArgs e)
		{
			ImageKit1.Appearance = IMAGEKIT7Lib.AppearanceConstants.ikFlat;		
		}

		//border - lowered
		private void Option3_1_Click(object sender, System.EventArgs e)
		{
			ImageKit1.Appearance = IMAGEKIT7Lib.AppearanceConstants.ikLowered;		
		}

		//border - raised
		private void Option3_2_Click(object sender, System.EventArgs e)
		{
			ImageKit1.Appearance = IMAGEKIT7Lib.AppearanceConstants.ikRaised;		
		}

		//scrollbars
		private void Check1_Click(object sender, System.EventArgs e)
		{
			if (Check1.Checked == true)
				ImageKit1.ScrollBar = true;
			else
				ImageKit1.ScrollBar = false;
		
			ImageKit1.Display(IMAGEKIT7Lib.DispModeConstants.ikActualSize);
		}

		//coordinates
		private void Show_ToolTip()
		{
			if (Check2.Checked == true)
				ImageKit1.ToolTip = Coordinate;
			else
				ImageKit1.ToolTip = IMAGEKIT7Lib.UnitConstants.ikNone;
		}	

		private void Check2_Click(object sender, System.EventArgs e)
		{
			Show_ToolTip();
		}

		//drag on/off
		private void Check3_Click(object sender, System.EventArgs e)
		{
			if (Check3.Checked == true)
				ImageKit1.MouseDragImage = true;
			else
				ImageKit1.MouseDragImage = false;
		}

		//graduation
		private void Show_Grad()
		{
			if (Check4.Checked == true)
				ImageKit1.Grad = Coordinate;
			else
				ImageKit1.Grad = IMAGEKIT7Lib.UnitConstants.ikNone;
		}

		private void Check4_Click(object sender, System.EventArgs e)
		{
			Show_Grad();
		}

		//grid
		private void Show_Grid()
		{
			if (Check5.Checked == true)
			{
				ImageKit1.GridSpace = Convert.ToDouble(Text3.Text);
				ImageKit1.Grid = Coordinate;
			} 
			else
				ImageKit1.Grid = IMAGEKIT7Lib.UnitConstants.ikNone;
		}	

		private void Check5_Click(object sender, System.EventArgs e)
		{
			Show_Grid();
		}

		//pan window
		private void Check6_Click(object sender, System.EventArgs e)
		{
			ImageKit1.PanWindow.Show(Check6.Checked);
		}

		//close button of pan window
		private void Check7_Click(object sender, System.EventArgs e)
		{
			ImageKit1.PanWindow.CloseBox = Check7.Checked;		
		}

		//caption of pan window
		private void Command4_Click(object sender, System.EventArgs e)
		{
			ImageKit1.PanWindow.Caption = Text2.Text;	
		}

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

		private void Form1_Closed(object sender, System.EventArgs e)
		{
			ProgressForm.Close();

		}

	}  
}
