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 Toggle
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label1;
private AxSftButtonLib25.AxSftButton axSftButton1;
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 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.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.axSftButton1 = new AxSftButtonLib25.AxSftButton();
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.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();
//
// button1
//
this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.button1.Location = new System.Drawing.Point(312, 8);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(56, 24);
this.button1.TabIndex = 0;
this.button1.Text = "Close";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// 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(296, 24);
this.label1.TabIndex = 1;
this.label1.Text = "SftButton/OCX As Toggle Button";
//
// axSftButton1
//
this.axSftButton1.Location = new System.Drawing.Point(24, 40);
this.axSftButton1.Name = "axSftButton1";
this.axSftButton1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axSftButton1.OcxState")));
this.axSftButton1.Size = new System.Drawing.Size(80, 28);
this.axSftButton1.TabIndex = 2;
//
// axSftButton2
//
this.axSftButton2.Location = new System.Drawing.Point(24, 80);
this.axSftButton2.Name = "axSftButton2";
this.axSftButton2.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axSftButton2.OcxState")));
this.axSftButton2.Size = new System.Drawing.Size(128, 48);
this.axSftButton2.TabIndex = 3;
//
// axSftButton3
//
this.axSftButton3.Location = new System.Drawing.Point(24, 144);
this.axSftButton3.Name = "axSftButton3";
this.axSftButton3.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axSftButton3.OcxState")));
this.axSftButton3.Size = new System.Drawing.Size(176, 48);
this.axSftButton3.TabIndex = 4;
this.axSftButton3.ClickEvent += new System.EventHandler(this.axSftButton3_ClickEvent);
this.axSftButton3.DblClick += new System.EventHandler(this.axSftButton3_DblClick);
//
// axSftButton4
//
this.axSftButton4.Location = new System.Drawing.Point(24, 208);
this.axSftButton4.Name = "axSftButton4";
this.axSftButton4.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axSftButton4.OcxState")));
this.axSftButton4.Size = new System.Drawing.Size(104, 28);
this.axSftButton4.TabIndex = 5;
//
// label2
//
this.label2.Location = new System.Drawing.Point(136, 40);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(160, 32);
this.label2.TabIndex = 6;
this.label2.Text = "Click each button to try the on/off positions.";
//
// label3
//
this.label3.Location = new System.Drawing.Point(152, 208);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(184, 40);
this.label3.TabIndex = 7;
this.label3.Text = "Even the drop down button can be used as a toggle button.";
//
// imageList1
//
this.imageList1.ImageSize = new System.Drawing.Size(30, 32);
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.White;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.CancelButton = this.button1;
this.ClientSize = new System.Drawing.Size(376, 266);
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.axSftButton1);
this.Controls.Add(this.label1);
this.Controls.Add(this.button1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Form1";
this.Text = "Softel vdm, Inc. - Toggle 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 ChangePicture_Button3()
{
// Change the pictures based on the button's Pressed status
if (axSftButton3.Pressed)
{
axSftButton3.Image1.NETImageObject = imageList1.Images[1];
axSftButton3.Image2.NETImageObject = imageList1.Images[0];
} else {
axSftButton3.Image1.NETImageObject = imageList1.Images[0];
axSftButton3.Image2.NETImageObject = imageList1.Images[1];
}
}
private void axSftButton3_ClickEvent(object sender, System.EventArgs e)
{
ChangePicture_Button3();
}
private void axSftButton3_DblClick(object sender, System.EventArgs e)
{
ChangePicture_Button3();
}
}
}