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

using AxSftButtonLib25;
using SftButtonLib25;
using Softelvdm.OLEConvert;

namespace Special
{
    /// <summary>
    /// Summary description for Form1.
    /// </summary>
	public class Form1 : System.Windows.Forms.Form
    {
        private AxSftButtonLib25.AxSftButton axSftButton1;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Button button1;
        private AxSftButtonLib25.AxSftButton axSftButton2;
        private AxSftButtonLib25.AxSftButton axSftButton3;
        private AxSftButtonLib25.AxSftButton axSftButton4;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.ImageList imageList1;
        private System.Windows.Forms.Timer picTimer;
        private System.Windows.Forms.Timer borderTimer;
        private System.Windows.Forms.Timer pressedTimer;
        private Softelvdm.OCXHelper.SftHelperComponent sftHelperComponent1;
        private System.ComponentModel.IContainer components;

    	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()
        {
            this.components = new System.ComponentModel.Container();
            System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
            this.axSftButton1 = new AxSftButtonLib25.AxSftButton();
            this.label1 = new System.Windows.Forms.Label();
            this.button1 = new System.Windows.Forms.Button();
            this.axSftButton2 = new AxSftButtonLib25.AxSftButton();
            this.axSftButton3 = new AxSftButtonLib25.AxSftButton();
            this.axSftButton4 = new AxSftButtonLib25.AxSftButton();
            this.label2 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.imageList1 = new System.Windows.Forms.ImageList(this.components);
            this.picTimer = new System.Windows.Forms.Timer(this.components);
            this.borderTimer = new System.Windows.Forms.Timer(this.components);
            this.pressedTimer = new System.Windows.Forms.Timer(this.components);
            this.sftHelperComponent1 = new Softelvdm.OCXHelper.SftHelperComponent(this.components);
            ((System.ComponentModel.ISupportInitialize)(this.axSftButton1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.axSftButton2)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.axSftButton3)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.axSftButton4)).BeginInit();
            this.SuspendLayout();
            // 
            // axSftButton1
            // 
            this.axSftButton1.Location = new System.Drawing.Point(16, 48);
            this.axSftButton1.Name = "axSftButton1";
            this.axSftButton1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axSftButton1.OcxState")));
            this.axSftButton1.Size = new System.Drawing.Size(104, 28);
            this.axSftButton1.TabIndex = 0;
            this.axSftButton1.HoverOn += new System.EventHandler(this.axSftButton1_HoverOn);
            this.axSftButton1.HoverOff += new System.EventHandler(this.axSftButton1_HoverOff);
            // 
            // label1
            // 
            this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.label1.Location = new System.Drawing.Point(8, 8);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(280, 24);
            this.label1.TabIndex = 1;
            this.label1.Text = "SftButton/OCX And Special Effects";
            // 
            // button1
            // 
            this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.button1.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.button1.Location = new System.Drawing.Point(304, 8);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(72, 24);
            this.button1.TabIndex = 7;
            this.button1.Text = "Close";
            this.button1.Click += new System.EventHandler(this.button1_Click);
            // 
            // axSftButton2
            // 
            this.axSftButton2.Location = new System.Drawing.Point(16, 96);
            this.axSftButton2.Name = "axSftButton2";
            this.axSftButton2.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axSftButton2.OcxState")));
            this.axSftButton2.Size = new System.Drawing.Size(104, 56);
            this.axSftButton2.TabIndex = 3;
            // 
            // axSftButton3
            // 
            this.axSftButton3.Location = new System.Drawing.Point(16, 176);
            this.axSftButton3.Name = "axSftButton3";
            this.axSftButton3.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axSftButton3.OcxState")));
            this.axSftButton3.Size = new System.Drawing.Size(72, 28);
            this.axSftButton3.TabIndex = 4;
            // 
            // axSftButton4
            // 
            this.axSftButton4.Location = new System.Drawing.Point(16, 224);
            this.axSftButton4.Name = "axSftButton4";
            this.axSftButton4.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axSftButton4.OcxState")));
            this.axSftButton4.Size = new System.Drawing.Size(96, 32);
            this.axSftButton4.TabIndex = 5;
            // 
            // label2
            // 
            this.label2.Location = new System.Drawing.Point(152, 48);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(208, 64);
            this.label2.TabIndex = 6;
            this.label2.Text = "Move the mouse cursor over the button on the left and you\'ll notice how the text " +
                "is underlined.";
            // 
            // label3
            // 
            this.label3.Location = new System.Drawing.Point(152, 152);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(208, 72);
            this.label3.TabIndex = 7;
            this.label3.Text = "Special effects are easily implemented.  These examples use a simple timer to upd" +
                "ate certain control properties.";
            // 
            // imageList1
            // 
            this.imageList1.ImageSize = new System.Drawing.Size(32, 32);
            this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
            this.imageList1.TransparentColor = System.Drawing.Color.White;
            // 
            // picTimer
            // 
            this.picTimer.Enabled = true;
            this.picTimer.Interval = 200;
            this.picTimer.Tick += new System.EventHandler(this.timer1_Tick);
            // 
            // borderTimer
            // 
            this.borderTimer.Enabled = true;
            this.borderTimer.Interval = 300;
            this.borderTimer.Tick += new System.EventHandler(this.borderTimer_Tick);
            // 
            // pressedTimer
            // 
            this.pressedTimer.Enabled = true;
            this.pressedTimer.Interval = 500;
            this.pressedTimer.Tick += new System.EventHandler(this.pressedTimer_Tick);
            // 
            // Form1
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.CancelButton = this.button1;
            this.ClientSize = new System.Drawing.Size(384, 278);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.axSftButton4);
            this.Controls.Add(this.axSftButton3);
            this.Controls.Add(this.axSftButton2);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.axSftButton1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name = "Form1";
            this.Text = "Softel vdm, Inc. - Special Sample";
            ((System.ComponentModel.ISupportInitialize)(this.axSftButton1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.axSftButton2)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.axSftButton3)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.axSftButton4)).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 button1_Click(object sender, System.EventArgs e)
        {
            Application.Exit();
        }

        private void axSftButton1_HoverOn(object sender, System.EventArgs e)
        {
            // The cursor is over the button, change the font
            // and button text
            axSftButton1.Font = new Font(axSftButton1.Font, FontStyle.Underline);
            axSftButton1.Text = "Click Me, Please";
        }

        private void axSftButton1_HoverOff(object sender, System.EventArgs e)
        {
            // The cursor has left the button, change the font
            // and button text back to their original settings
            axSftButton1.Font = new Font(axSftButton1.Font, FontStyle.Regular);
            axSftButton1.Text = "Click Me";
        }

        private int m_WorldIndex = 0;

        private void SetImage()
        {
            // Update the button with the next image in the image list
            // to get the spinning globe effect
            axSftButton2.Image1.NETImageObject = imageList1.Images[m_WorldIndex];
            ++m_WorldIndex;
            if (m_WorldIndex >= imageList1.Images.Count) m_WorldIndex = 0;
        }

        private void timer1_Tick(object sender, System.EventArgs e)
        {
            // Update the button bitmap every so often to get the
            // spinning globe effect
            SetImage();
        }

        private void borderTimer_Tick(object sender, System.EventArgs e)
        {
            // Change the button border
            if (axSftButton3.Pressed || axSftButton3.DarkEdgeColor != SystemColors.ControlDarkDark) 
            {
                axSftButton3.DarkEdgeColor = SystemColors.ControlDarkDark;
                axSftButton3.ShadowEdgeColor = SystemColors.ControlDark;
                axSftButton3.LightEdgeColor = SystemColors.ControlLight;
                axSftButton3.WhiteEdgeColor = SystemColors.ControlLightLight;
            } else {
                axSftButton3.DarkEdgeColor = SystemColors.ControlLightLight;
                axSftButton3.ShadowEdgeColor = SystemColors.ControlLightLight;
                axSftButton3.LightEdgeColor = SystemColors.ControlLightLight;
                axSftButton3.WhiteEdgeColor = SystemColors.ControlLightLight;
            }
        }

        private void pressedTimer_Tick(object sender, System.EventArgs e)
        {
            // Toggle the button and drop down button state
            if (axSftButton4.Pressed) 
            {
                if (axSftButton4.DropDownPressed)
                    axSftButton4.Pressed = false;
                else
                    axSftButton4.DropDownPressed = true;
            } else {
                if (axSftButton4.DropDownPressed)
                    axSftButton4.DropDownPressed = false;
                else
                    axSftButton4.Pressed = true;
            }
        }

    }
}