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.TextBox Text5;
		public System.Windows.Forms.TextBox Text4;
		public System.Windows.Forms.TextBox Text3;
		public System.Windows.Forms.TextBox Text2;
		public System.Windows.Forms.Label Label4;
		public System.Windows.Forms.Label Label3;
		public System.Windows.Forms.Label Label2;
		public System.Windows.Forms.Label Label1;
		public System.Windows.Forms.Button Command4;
		public System.Windows.Forms.TextBox Text1;
		public System.Windows.Forms.Button Command3;
		public System.Windows.Forms.Button Command2;
		public System.Windows.Forms.Button Command1;
		private AxIMAGEKIT7Lib.AxImageKit ImageKit1;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		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.Text5 = new System.Windows.Forms.TextBox();
			this.Text4 = new System.Windows.Forms.TextBox();
			this.Text3 = new System.Windows.Forms.TextBox();
			this.Text2 = new System.Windows.Forms.TextBox();
			this.Label4 = new System.Windows.Forms.Label();
			this.Label3 = new System.Windows.Forms.Label();
			this.Label2 = new System.Windows.Forms.Label();
			this.Label1 = new System.Windows.Forms.Label();
			this.Command4 = new System.Windows.Forms.Button();
			this.Text1 = new System.Windows.Forms.TextBox();
			this.Command3 = new System.Windows.Forms.Button();
			this.Command2 = new System.Windows.Forms.Button();
			this.Command1 = new System.Windows.Forms.Button();
			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.Text5);
			this.Frame1.Controls.Add(this.Text4);
			this.Frame1.Controls.Add(this.Text3);
			this.Frame1.Controls.Add(this.Text2);
			this.Frame1.Controls.Add(this.Label4);
			this.Frame1.Controls.Add(this.Label3);
			this.Frame1.Controls.Add(this.Label2);
			this.Frame1.Controls.Add(this.Label1);
			this.Frame1.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.Frame1.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Frame1.Location = new System.Drawing.Point(462, 126);
			this.Frame1.Name = "Frame1";
			this.Frame1.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Frame1.Size = new System.Drawing.Size(113, 121);
			this.Frame1.TabIndex = 12;
			this.Frame1.TabStop = false;
			this.Frame1.Text = "Print Output";
			// 
			// Text5
			// 
			this.Text5.AcceptsReturn = true;
			this.Text5.AutoSize = false;
			this.Text5.BackColor = System.Drawing.SystemColors.Window;
			this.Text5.Cursor = System.Windows.Forms.Cursors.IBeam;
			this.Text5.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.Text5.ForeColor = System.Drawing.SystemColors.WindowText;
			this.Text5.Location = new System.Drawing.Point(56, 88);
			this.Text5.MaxLength = 0;
			this.Text5.Name = "Text5";
			this.Text5.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Text5.Size = new System.Drawing.Size(41, 19);
			this.Text5.TabIndex = 10;
			this.Text5.Text = "1100";
			// 
			// Text4
			// 
			this.Text4.AcceptsReturn = true;
			this.Text4.AutoSize = false;
			this.Text4.BackColor = System.Drawing.SystemColors.Window;
			this.Text4.Cursor = System.Windows.Forms.Cursors.IBeam;
			this.Text4.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.Text4.ForeColor = System.Drawing.SystemColors.WindowText;
			this.Text4.Location = new System.Drawing.Point(56, 64);
			this.Text4.MaxLength = 0;
			this.Text4.Name = "Text4";
			this.Text4.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Text4.Size = new System.Drawing.Size(41, 19);
			this.Text4.TabIndex = 9;
			this.Text4.Text = "1100";
			// 
			// 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.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.Text3.ForeColor = System.Drawing.SystemColors.WindowText;
			this.Text3.Location = new System.Drawing.Point(56, 40);
			this.Text3.MaxLength = 0;
			this.Text3.Name = "Text3";
			this.Text3.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Text3.Size = new System.Drawing.Size(41, 19);
			this.Text3.TabIndex = 8;
			this.Text3.Text = "100";
			// 
			// 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.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.Text2.ForeColor = System.Drawing.SystemColors.WindowText;
			this.Text2.Location = new System.Drawing.Point(56, 16);
			this.Text2.MaxLength = 0;
			this.Text2.Name = "Text2";
			this.Text2.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Text2.Size = new System.Drawing.Size(41, 19);
			this.Text2.TabIndex = 7;
			this.Text2.Text = "100";
			// 
			// Label4
			// 
			this.Label4.BackColor = System.Drawing.SystemColors.Control;
			this.Label4.Cursor = System.Windows.Forms.Cursors.Default;
			this.Label4.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.Label4.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Label4.Location = new System.Drawing.Point(16, 88);
			this.Label4.Name = "Label4";
			this.Label4.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Label4.Size = new System.Drawing.Size(41, 17);
			this.Label4.TabIndex = 14;
			this.Label4.Text = "Right";
			// 
			// Label3
			// 
			this.Label3.BackColor = System.Drawing.SystemColors.Control;
			this.Label3.Cursor = System.Windows.Forms.Cursors.Default;
			this.Label3.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.Label3.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Label3.Location = new System.Drawing.Point(16, 64);
			this.Label3.Name = "Label3";
			this.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Label3.Size = new System.Drawing.Size(41, 17);
			this.Label3.TabIndex = 13;
			this.Label3.Text = "Bottom";
			// 
			// Label2
			// 
			this.Label2.BackColor = System.Drawing.SystemColors.Control;
			this.Label2.Cursor = System.Windows.Forms.Cursors.Default;
			this.Label2.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.Label2.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Label2.Location = new System.Drawing.Point(16, 40);
			this.Label2.Name = "Label2";
			this.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Label2.Size = new System.Drawing.Size(33, 17);
			this.Label2.TabIndex = 12;
			this.Label2.Text = "Left";
			// 
			// Label1
			// 
			this.Label1.BackColor = System.Drawing.SystemColors.Control;
			this.Label1.Cursor = System.Windows.Forms.Cursors.Default;
			this.Label1.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.Label1.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Label1.Location = new System.Drawing.Point(16, 16);
			this.Label1.Name = "Label1";
			this.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Label1.Size = new System.Drawing.Size(41, 17);
			this.Label1.TabIndex = 11;
			this.Label1.Text = "Top";
			// 
			// Command4
			// 
			this.Command4.BackColor = System.Drawing.SystemColors.Control;
			this.Command4.Cursor = System.Windows.Forms.Cursors.Default;
			this.Command4.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.Command4.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Command4.Location = new System.Drawing.Point(462, 318);
			this.Command4.Name = "Command4";
			this.Command4.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Command4.Size = new System.Drawing.Size(113, 49);
			this.Command4.TabIndex = 11;
			this.Command4.Text = "Print In Pixel Units";
			this.Command4.Click += new System.EventHandler(this.Command4_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.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(6, 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, 64);
			this.Text1.TabIndex = 10;
			this.Text1.Text = @"The ImageOut method makes it easy to print images. Set printer output in absolute units (0.1mm). This makes your print code resolution independent. Rest assured that your printer output will always be the same size regardless of the printer that you use. Of course, you can also choose printer output in pixel units. This sample illustrates the difference.";
			// 
			// Command3
			// 
			this.Command3.BackColor = System.Drawing.SystemColors.Control;
			this.Command3.Cursor = System.Windows.Forms.Cursors.Default;
			this.Command3.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.Command3.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Command3.Location = new System.Drawing.Point(462, 382);
			this.Command3.Name = "Command3";
			this.Command3.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Command3.Size = new System.Drawing.Size(113, 33);
			this.Command3.TabIndex = 9;
			this.Command3.Text = "End";
			this.Command3.Click += new System.EventHandler(this.Command3_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(462, 254);
			this.Command2.Name = "Command2";
			this.Command2.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Command2.Size = new System.Drawing.Size(113, 49);
			this.Command2.TabIndex = 8;
			this.Command2.Text = "Print In 0.1mm Units";
			this.Command2.Click += new System.EventHandler(this.Command2_Click);
			// 
			// 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(462, 78);
			this.Command1.Name = "Command1";
			this.Command1.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Command1.Size = new System.Drawing.Size(113, 33);
			this.Command1.TabIndex = 7;
			this.Command1.Text = "Load Image";
			this.Command1.Click += new System.EventHandler(this.Command1_Click);
			// 
			// ImageKit1
			// 
			this.ImageKit1.Location = new System.Drawing.Point(8, 64);
			this.ImageKit1.Name = "ImageKit1";
			this.ImageKit1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("ImageKit1.OcxState")));
			this.ImageKit1.Size = new System.Drawing.Size(449, 361);
			this.ImageKit1.TabIndex = 13;
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(584, 430);
			this.Controls.Add(this.ImageKit1);
			this.Controls.Add(this.Frame1);
			this.Controls.Add(this.Command4);
			this.Controls.Add(this.Text1);
			this.Controls.Add(this.Command3);
			this.Controls.Add(this.Command2);
			this.Controls.Add(this.Command1);
			this.Name = "Form1";
			this.Text = "Getting Started Printing";
			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)
		{
			//displays the 'Open File' dialog and allows you to select an image to load...
			if (ImageKit1.File.OpenFileDialog() == false) 
			{
				return;
			}
					
			//loads the image...
			ImageKit1.File.LoadFile(IMAGEKIT7Lib.LoadFileConstants.ikLoad);
		
			//displays the image in scale display mode...
			ImageKit1.Display(IMAGEKIT7Lib.DispModeConstants.ikScale);
		}

		private void Command2_Click(object sender, System.EventArgs e)
		{
			bool ret;
		
			//Display the "Print" dialog...
			ret = ImageKit1.PrintDraw.PrintDialog();
			
			// Start a print document...
			ret = ImageKit1.PrintDraw.PrintStartDoc();
			// Start a print page...
			ret = ImageKit1.PrintDraw.PrintStartPage();
			
			//print an image...
			if (ImageKit1.ImageHandle != 0) 
			{
				//The ImageOut method prints the image on the page. When the last
				//parameter, "DeviceMode" is set to 1 (ikPrinter), the output units are 0.1mm and
				//are printer resolution independent. If set to 0 (ikScreen) then the output
				//units are pixels and the size of the output will depend on the printer's
				//resolution....
				ret = ImageKit1.PrintDraw.ImageOut(ImageKit1.PrintDraw.hDC, ImageKit1.ImageHandle, Convert.ToInt32(Text3.Text), Convert.ToInt32(Text2.Text), Convert.ToInt32(Text5.Text), Convert.ToInt32(Text4.Text), true, false, IMAGEKIT7Lib.OutPutDeviceModeConstants.ikPrinter);
			}
			
			// end the print page...
			ImageKit1.PrintDraw.PrintEndPage();
			//end the print document...
			ImageKit1.PrintDraw.PrintEndDoc();
		}

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

		private void Command4_Click(object sender, System.EventArgs e)
		{
			bool ret;
			
			//Display the "Print" dialog...
			ret = ImageKit1.PrintDraw.PrintDialog();
			
			//Start a print document...
			ret = ImageKit1.PrintDraw.PrintStartDoc();
			//Start a print page...
			ret = ImageKit1.PrintDraw.PrintStartPage();
		
			//print an image...
			if (ImageKit1.ImageHandle != 0) 
			{
				//The ImageOut method prints the image on the page. When the last
				//parameter, "DeviceMode" is set to 1 (ikPrinter), the output units are 0.1mm and
				//are printer resolution independent. If set to 0 (ikScreen) then the output
				//units are pixels and the size of the output will depend on the printer's
				//resolution....
				ret = ImageKit1.PrintDraw.ImageOut(ImageKit1.PrintDraw.hDC, ImageKit1.ImageHandle, Convert.ToInt32(Text3.Text), Convert.ToInt32(Text2.Text), Convert.ToInt32(Text5.Text), Convert.ToInt32(Text4.Text), true, false, IMAGEKIT7Lib.OutPutDeviceModeConstants.ikScreen);
			}		
			//end the print page...
			ImageKit1.PrintDraw.PrintEndPage();
			//end the print document...
			ImageKit1.PrintDraw.PrintEndDoc();
		}
	}
}
