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.Button Command1;
		public System.Windows.Forms.TextBox Text2;
		private AxIMAGEKIT7Lib.AxImageKit ImageKit1;
		private AxIMAGEKIT7THUMBLib.AxImageKitThumb ImageKitThumb1;
		/// <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.Command1 = new System.Windows.Forms.Button();
			this.Text2 = new System.Windows.Forms.TextBox();
			this.ImageKit1 = new AxIMAGEKIT7Lib.AxImageKit();
			this.ImageKitThumb1 = new AxIMAGEKIT7THUMBLib.AxImageKitThumb();
			((System.ComponentModel.ISupportInitialize)(this.ImageKit1)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.ImageKitThumb1)).BeginInit();
			this.SuspendLayout();
			// 
			// 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(400, 88);
			this.Command1.Name = "Command1";
			this.Command1.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Command1.Size = new System.Drawing.Size(152, 33);
			this.Command1.TabIndex = 5;
			this.Command1.Text = "Load Thumbnail Images";
			this.Command1.Click += new System.EventHandler(this.Command1_Click);
			// 
			// Text2
			// 
			this.Text2.AcceptsReturn = true;
			this.Text2.AutoSize = false;
			this.Text2.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(255)), ((System.Byte)(192)));
			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.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(0)), ((System.Byte)(0)));
			this.Text2.Location = new System.Drawing.Point(8, 0);
			this.Text2.MaxLength = 0;
			this.Text2.Multiline = true;
			this.Text2.Name = "Text2";
			this.Text2.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Text2.Size = new System.Drawing.Size(600, 80);
			this.Text2.TabIndex = 4;
			this.Text2.Text = @"This sample shows how to click a thumbnail image and display it in the ImageKit Control. Selecting a thumbnail generates the SelectFile event where the image filename and path can be retrieved and used to load the image into the ImageKit Control. The Thumbnail Control can do a variety of things easily like display images from multiple directories, load only images of a certain type or certain filenames, display text under thumbnails, etc. In this sample, only JPEG images are loaded.";
			// 
			// ImageKit1
			// 
			this.ImageKit1.Location = new System.Drawing.Point(8, 88);
			this.ImageKit1.Name = "ImageKit1";
			this.ImageKit1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("ImageKit1.OcxState")));
			this.ImageKit1.Size = new System.Drawing.Size(321, 360);
			this.ImageKit1.TabIndex = 6;
			// 
			// ImageKitThumb1
			// 
			this.ImageKitThumb1.Location = new System.Drawing.Point(336, 136);
			this.ImageKitThumb1.Name = "ImageKitThumb1";
			this.ImageKitThumb1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("ImageKitThumb1.OcxState")));
			this.ImageKitThumb1.Size = new System.Drawing.Size(273, 313);
			this.ImageKitThumb1.TabIndex = 7;
			this.ImageKitThumb1.SelectFile += new AxIMAGEKIT7THUMBLib._IImageKitThumbEvents_SelectFileEventHandler(this.ImageKitThumb1_SelectFile);
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(616, 462);
			this.Controls.Add(this.ImageKitThumb1);
			this.Controls.Add(this.ImageKit1);
			this.Controls.Add(this.Command1);
			this.Controls.Add(this.Text2);
			this.Name = "Form1";
			this.Text = "Select a Thumbnail and Display the Image";
			((System.ComponentModel.ISupportInitialize)(this.ImageKit1)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.ImageKitThumb1)).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)
		{
			//set the types of images that can be loaded into the thumbnail control...
			ImageKitThumb1.FileExt = "JPG";
			
			//set the path to the images...
			ImageKitThumb1.FilePath = Application.StartupPath + "\\..\\..\\..\\..\\..\\..\\..\\Images\\ForSamples\\Thumbnails\\";
			
			//display the images in the thumbnail control...
			ImageKitThumb1.GetFiles();
			ImageKitThumb1.Display();
			
			//display the filenames under the thumbnail images...
			ImageKitThumb1.DispFileName = true;
		}

		private void ImageKitThumb1_SelectFile(object sender, AxIMAGEKIT7THUMBLib._IImageKitThumbEvents_SelectFileEvent e)
		{
			//set the filename and path of the image whose thumbnail has been selected...
			ImageKit1.File.FileName = e.pathName + e.fileName;

			//load the image file...
			ImageKit1.File.LoadFile(IMAGEKIT7Lib.LoadFileConstants.ikLoad);

			//display the image in actual sized display mode...
			ImageKit1.ScrollBar = true;
			ImageKit1.Display(IMAGEKIT7Lib.DispModeConstants.ikActualSize);
		}
	}
}
