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

using SftDirectoryLib25;
using AxSftDirectoryLib25;
using Softelvdm.OLEConvert;

namespace FullTreeView
{
    /// <summary>
    /// Summary description for Form1.
    /// </summary>
    public class Form1 : System.Windows.Forms.Form
    {
        private AxSftDirectoryLib25.AxSftDirectory axSftDirectory1;
        private System.Windows.Forms.PictureBox pictureBox1;
        private System.Windows.Forms.Label labelInfoTip;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Button closeButton;
        private System.Windows.Forms.Label label2;
        /// <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.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
            this.axSftDirectory1 = new AxSftDirectoryLib25.AxSftDirectory();
            this.pictureBox1 = new System.Windows.Forms.PictureBox();
            this.labelInfoTip = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.closeButton = new System.Windows.Forms.Button();
            this.label2 = new System.Windows.Forms.Label();
            ((System.ComponentModel.ISupportInitialize)(this.axSftDirectory1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
            this.SuspendLayout();
            // 
            // axSftDirectory1
            // 
            this.axSftDirectory1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.axSftDirectory1.Location = new System.Drawing.Point(8, 40);
            this.axSftDirectory1.Name = "axSftDirectory1";
            this.axSftDirectory1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axSftDirectory1.OcxState")));
            this.axSftDirectory1.Size = new System.Drawing.Size(568, 312);
            this.axSftDirectory1.TabIndex = 5;
            this.axSftDirectory1.FolderImageReady += new AxSftDirectoryLib25._ISftDirectoryEvents_FolderImageReadyEventHandler(this.axSftDirectory1_FolderImageReady);
            this.axSftDirectory1.SelectionFinal += new System.EventHandler(this.axSftDirectory1_SelectionFinal);
            // 
            // pictureBox1
            // 
            this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
            this.pictureBox1.Location = new System.Drawing.Point(8, 360);
            this.pictureBox1.Name = "pictureBox1";
            this.pictureBox1.Size = new System.Drawing.Size(88, 72);
            this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
            this.pictureBox1.TabIndex = 1;
            this.pictureBox1.TabStop = false;
            // 
            // labelInfoTip
            // 
            this.labelInfoTip.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.labelInfoTip.Location = new System.Drawing.Point(104, 360);
            this.labelInfoTip.Name = "labelInfoTip";
            this.labelInfoTip.Size = new System.Drawing.Size(544, 72);
            this.labelInfoTip.TabIndex = 2;
            this.labelInfoTip.Text = "Area for InfoTip";
            // 
            // label1
            // 
            this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.label1.Location = new System.Drawing.Point(8, 8);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(640, 32);
            this.label1.TabIndex = 3;
            this.label1.Text = "Files and folders in a multi-column, multi-selection treeview control.  Supports " +
                "drag && drop, (right click) context menus, file/folder renaming and reorderable " +
                "columns (except the first column).";
            // 
            // closeButton
            // 
            this.closeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.closeButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.closeButton.Location = new System.Drawing.Point(584, 40);
            this.closeButton.Name = "closeButton";
            this.closeButton.Size = new System.Drawing.Size(64, 24);
            this.closeButton.TabIndex = 1;
            this.closeButton.Text = "Close";
            this.closeButton.Click += new System.EventHandler(this.closeButton_Click);
            // 
            // label2
            // 
            this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label2.Location = new System.Drawing.Point(136, 376);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(504, 64);
            this.label2.TabIndex = 4;
            this.label2.Text = "Click on the SftDirectory control above and hit F1 to access help information for" +
                " SftDirectory 2.5";
            this.label2.Visible = false;
            // 
            // Form1
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(656, 438);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.closeButton);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.labelInfoTip);
            this.Controls.Add(this.pictureBox1);
            this.Controls.Add(this.axSftDirectory1);
            this.MinimumSize = new System.Drawing.Size(500, 400);
            this.Name = "Form1";
            this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
            this.Text = "FullTreeView Sample - Softel vdm, Inc.";
            ((System.ComponentModel.ISupportInitialize)(this.axSftDirectory1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
            this.ResumeLayout(false);

        }
        #endregion

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

        private void axSftDirectory1_SelectionFinal(object sender, System.EventArgs e) {
            if (axSftDirectory1.CurrentFolder != null) {
                axSftDirectory1.CurrentFolder.GetImage();
                labelInfoTip.Text = axSftDirectory1.CurrentFolder.InfoTip;
            } else {
                pictureBox1.Image = null;
                labelInfoTip.Text = "";
            }
        }

        private void axSftDirectory1_FolderImageReady(object sender, AxSftDirectoryLib25._ISftDirectoryEvents_FolderImageReadyEvent e) {
            pictureBox1.Image = OLECvt.ToImage(e.picture);
        }

        private void closeButton_Click(object sender, System.EventArgs e) {
            Application.Exit();
        }

    }
}