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 ControlStyles
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
public System.Windows.Forms.CheckBox CheckShowHeaders;
public System.Windows.Forms.CheckBox CheckCheckBoxes;
public System.Windows.Forms.CheckBox CheckTreeLines;
public System.Windows.Forms.Label Label8;
public System.Windows.Forms.Label Label7;
public System.Windows.Forms.Label Label6;
public System.Windows.Forms.Label Label5;
public System.Windows.Forms.Label Label4;
public System.Windows.Forms.Label Label3;
public System.Windows.Forms.Label Label2;
public System.Windows.Forms.Label Label1;
private AxSftDirectoryLib25.AxSftDirectory axSftDirectoryTV;
private AxSftDirectoryLib25.AxSftDirectory axSftDirectoryTV_Combo;
private AxSftDirectoryLib25.AxSftDirectory axSftDirectoryDL;
private AxSftDirectoryLib25.AxSftDirectory axSftDirectoryDL_Combo;
private System.Windows.Forms.Button CloseButton;
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.CheckShowHeaders = new System.Windows.Forms.CheckBox();
this.CheckCheckBoxes = new System.Windows.Forms.CheckBox();
this.CheckTreeLines = new System.Windows.Forms.CheckBox();
this.Label8 = new System.Windows.Forms.Label();
this.Label7 = new System.Windows.Forms.Label();
this.Label6 = new System.Windows.Forms.Label();
this.Label5 = new System.Windows.Forms.Label();
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.axSftDirectoryTV = new AxSftDirectoryLib25.AxSftDirectory();
this.axSftDirectoryDL = new AxSftDirectoryLib25.AxSftDirectory();
this.axSftDirectoryTV_Combo = new AxSftDirectoryLib25.AxSftDirectory();
this.axSftDirectoryDL_Combo = new AxSftDirectoryLib25.AxSftDirectory();
this.CloseButton = new System.Windows.Forms.Button();
this.sftHelperComponent1 = new Softelvdm.OCXHelper.SftHelperComponent(this.components);
((System.ComponentModel.ISupportInitialize)(this.axSftDirectoryTV)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.axSftDirectoryDL)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.axSftDirectoryTV_Combo)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.axSftDirectoryDL_Combo)).BeginInit();
this.SuspendLayout();
//
// CheckShowHeaders
//
this.CheckShowHeaders.BackColor = System.Drawing.SystemColors.Control;
this.CheckShowHeaders.Cursor = System.Windows.Forms.Cursors.Default;
this.CheckShowHeaders.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.CheckShowHeaders.ForeColor = System.Drawing.SystemColors.ControlText;
this.CheckShowHeaders.Location = new System.Drawing.Point(9, 453);
this.CheckShowHeaders.Name = "CheckShowHeaders";
this.CheckShowHeaders.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.CheckShowHeaders.Size = new System.Drawing.Size(265, 17);
this.CheckShowHeaders.TabIndex = 6;
this.CheckShowHeaders.Text = "Show headers (with sortable columns)";
this.CheckShowHeaders.CheckedChanged += new System.EventHandler(this.CheckShowHeaders_CheckedChanged);
//
// CheckCheckBoxes
//
this.CheckCheckBoxes.BackColor = System.Drawing.SystemColors.Control;
this.CheckCheckBoxes.Cursor = System.Windows.Forms.Cursors.Default;
this.CheckCheckBoxes.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.CheckCheckBoxes.ForeColor = System.Drawing.SystemColors.ControlText;
this.CheckCheckBoxes.Location = new System.Drawing.Point(9, 429);
this.CheckCheckBoxes.Name = "CheckCheckBoxes";
this.CheckCheckBoxes.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.CheckCheckBoxes.Size = new System.Drawing.Size(265, 17);
this.CheckCheckBoxes.TabIndex = 5;
this.CheckCheckBoxes.Text = "Show check boxes";
this.CheckCheckBoxes.CheckedChanged += new System.EventHandler(this.CheckCheckBoxes_CheckedChanged);
//
// CheckTreeLines
//
this.CheckTreeLines.BackColor = System.Drawing.SystemColors.Control;
this.CheckTreeLines.Cursor = System.Windows.Forms.Cursors.Default;
this.CheckTreeLines.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.CheckTreeLines.ForeColor = System.Drawing.SystemColors.ControlText;
this.CheckTreeLines.Location = new System.Drawing.Point(9, 405);
this.CheckTreeLines.Name = "CheckTreeLines";
this.CheckTreeLines.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.CheckTreeLines.Size = new System.Drawing.Size(265, 17);
this.CheckTreeLines.TabIndex = 4;
this.CheckTreeLines.Text = "Show tree lines for treeview style controls";
this.CheckTreeLines.CheckedChanged += new System.EventHandler(this.CheckTreeLines_CheckedChanged);
//
// Label8
//
this.Label8.BackColor = System.Drawing.SystemColors.Control;
this.Label8.Cursor = System.Windows.Forms.Cursors.Default;
this.Label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Label8.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label8.Location = new System.Drawing.Point(321, 285);
this.Label8.Name = "Label8";
this.Label8.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label8.Size = new System.Drawing.Size(233, 105);
this.Label8.TabIndex = 25;
this.Label8.Text = "The combo boxes are also resizable when opened. Try resizing the control! If you" +
" end and restart the sample, the height is preserved, because the RegistryLocati" +
"on property is used.";
//
// Label7
//
this.Label7.BackColor = System.Drawing.SystemColors.Control;
this.Label7.Cursor = System.Windows.Forms.Cursors.Default;
this.Label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Label7.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label7.Location = new System.Drawing.Point(321, 117);
this.Label7.Name = "Label7";
this.Label7.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label7.Size = new System.Drawing.Size(233, 105);
this.Label7.TabIndex = 24;
this.Label7.Text = "All control styles support context menus too! Even the combo boxes. Of course yo" +
"u can turn them off with the ShowContextMenu property.";
//
// Label6
//
this.Label6.BackColor = System.Drawing.SystemColors.Control;
this.Label6.Cursor = System.Windows.Forms.Cursors.Default;
this.Label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Label6.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label6.Location = new System.Drawing.Point(9, 21);
this.Label6.Name = "Label6";
this.Label6.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label6.Size = new System.Drawing.Size(551, 33);
this.Label6.TabIndex = 22;
this.Label6.Text = "SftDirectory supports these 4 basic control styles. Each can be further customiz" +
"ed with multiple columns, headers, colors and many other attributes.";
//
// Label5
//
this.Label5.BackColor = System.Drawing.SystemColors.Control;
this.Label5.Cursor = System.Windows.Forms.Cursors.Default;
this.Label5.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Label5.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label5.Location = new System.Drawing.Point(321, 229);
this.Label5.Name = "Label5";
this.Label5.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label5.Size = new System.Drawing.Size(169, 17);
this.Label5.TabIndex = 19;
this.Label5.Text = "DetailList Combo Box";
//
// Label4
//
this.Label4.BackColor = System.Drawing.SystemColors.Control;
this.Label4.Cursor = System.Windows.Forms.Cursors.Default;
this.Label4.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Label4.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label4.Location = new System.Drawing.Point(321, 61);
this.Label4.Name = "Label4";
this.Label4.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label4.Size = new System.Drawing.Size(169, 17);
this.Label4.TabIndex = 18;
this.Label4.Text = "TreeView Combo Box";
//
// Label3
//
this.Label3.BackColor = System.Drawing.SystemColors.Control;
this.Label3.Cursor = System.Windows.Forms.Cursors.Default;
this.Label3.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Label3.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label3.Location = new System.Drawing.Point(9, 229);
this.Label3.Name = "Label3";
this.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label3.Size = new System.Drawing.Size(169, 17);
this.Label3.TabIndex = 17;
this.Label3.Text = "DetailList";
//
// Label2
//
this.Label2.BackColor = System.Drawing.SystemColors.Control;
this.Label2.Cursor = System.Windows.Forms.Cursors.Default;
this.Label2.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Label2.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label2.Location = new System.Drawing.Point(9, 61);
this.Label2.Name = "Label2";
this.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label2.Size = new System.Drawing.Size(169, 17);
this.Label2.TabIndex = 16;
this.Label2.Text = "TreeView";
//
// Label1
//
this.Label1.BackColor = System.Drawing.SystemColors.Control;
this.Label1.Cursor = System.Windows.Forms.Cursors.Default;
this.Label1.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Label1.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label1.Location = new System.Drawing.Point(9, 5);
this.Label1.Name = "Label1";
this.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label1.Size = new System.Drawing.Size(161, 17);
this.Label1.TabIndex = 15;
this.Label1.Text = "Control Styles";
//
// axSftDirectoryTV
//
this.axSftDirectoryTV.Location = new System.Drawing.Point(8, 80);
this.axSftDirectoryTV.Name = "axSftDirectoryTV";
this.axSftDirectoryTV.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axSftDirectoryTV.OcxState")));
this.axSftDirectoryTV.Size = new System.Drawing.Size(272, 144);
this.axSftDirectoryTV.TabIndex = 0;
this.axSftDirectoryTV.CheckBoxClicked += new AxSftDirectoryLib25._ISftDirectoryEvents_CheckBoxClickedEventHandler(this.axSftDirectoryTV_CheckBoxClicked);
//
// axSftDirectoryDL
//
this.axSftDirectoryDL.Location = new System.Drawing.Point(8, 248);
this.axSftDirectoryDL.Name = "axSftDirectoryDL";
this.axSftDirectoryDL.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axSftDirectoryDL.OcxState")));
this.axSftDirectoryDL.Size = new System.Drawing.Size(272, 144);
this.axSftDirectoryDL.TabIndex = 1;
//
// axSftDirectoryTV_Combo
//
this.axSftDirectoryTV_Combo.Location = new System.Drawing.Point(320, 80);
this.axSftDirectoryTV_Combo.Name = "axSftDirectoryTV_Combo";
this.axSftDirectoryTV_Combo.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axSftDirectoryTV_Combo.OcxState")));
this.axSftDirectoryTV_Combo.Size = new System.Drawing.Size(240, 21);
this.axSftDirectoryTV_Combo.TabIndex = 2;
this.axSftDirectoryTV_Combo.CheckBoxClicked += new AxSftDirectoryLib25._ISftDirectoryEvents_CheckBoxClickedEventHandler(this.axSftDirectoryTV_Combo_CheckBoxClicked);
//
// axSftDirectoryDL_Combo
//
this.axSftDirectoryDL_Combo.Location = new System.Drawing.Point(320, 256);
this.axSftDirectoryDL_Combo.Name = "axSftDirectoryDL_Combo";
this.axSftDirectoryDL_Combo.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axSftDirectoryDL_Combo.OcxState")));
this.axSftDirectoryDL_Combo.Size = new System.Drawing.Size(240, 21);
this.axSftDirectoryDL_Combo.TabIndex = 3;
//
// CloseButton
//
this.CloseButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.CloseButton.Location = new System.Drawing.Point(568, 8);
this.CloseButton.Name = "CloseButton";
this.CloseButton.Size = new System.Drawing.Size(56, 24);
this.CloseButton.TabIndex = 7;
this.CloseButton.Text = "Close";
this.CloseButton.Click += new System.EventHandler(this.CloseButton_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(634, 474);
this.Controls.Add(this.CloseButton);
this.Controls.Add(this.axSftDirectoryDL_Combo);
this.Controls.Add(this.axSftDirectoryTV_Combo);
this.Controls.Add(this.axSftDirectoryDL);
this.Controls.Add(this.axSftDirectoryTV);
this.Controls.Add(this.CheckShowHeaders);
this.Controls.Add(this.CheckCheckBoxes);
this.Controls.Add(this.CheckTreeLines);
this.Controls.Add(this.Label8);
this.Controls.Add(this.Label7);
this.Controls.Add(this.Label6);
this.Controls.Add(this.Label5);
this.Controls.Add(this.Label4);
this.Controls.Add(this.Label3);
this.Controls.Add(this.Label2);
this.Controls.Add(this.Label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "Form1";
this.Text = "ControlStyles Sample - Softel vdm, Inc.";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.axSftDirectoryTV)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.axSftDirectoryDL)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.axSftDirectoryTV_Combo)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.axSftDirectoryDL_Combo)).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 CheckTreeLines_CheckedChanged(object sender, System.EventArgs e) {
SftDirectoryTreeLineStyleConstants style;
if (CheckTreeLines.CheckState == CheckState.Checked)
style = SftDirectoryTreeLineStyleConstants.treeLineStyleSftDirectoryDotted;
else
style = SftDirectoryTreeLineStyleConstants.treeLineStyleSftDirectoryNone;
axSftDirectoryTV.TreeLineStyle = style;
axSftDirectoryDL.TreeLineStyle = style;
axSftDirectoryTV_Combo.TreeLineStyle = style;
axSftDirectoryDL_Combo.TreeLineStyle = style;
}
private void CheckCheckBoxes_CheckedChanged(object sender, System.EventArgs e) {
SftDirectoryCheckBoxDisplayConstants style;
if (CheckCheckBoxes.CheckState == CheckState.Checked)
style = SftDirectoryCheckBoxDisplayConstants.checkboxDisplaySftDirectoryAll;
else
style = SftDirectoryCheckBoxDisplayConstants.checkboxDisplaySftDirectoryNone;
axSftDirectoryTV.ShowCheckBoxes = style;
axSftDirectoryDL.ShowCheckBoxes = style;
axSftDirectoryTV_Combo.ShowCheckBoxes = style;
axSftDirectoryDL_Combo.ShowCheckBoxes = style;
}
private void CheckShowHeaders_CheckedChanged(object sender, System.EventArgs e) {
SftDirectoryHeadersStyleConstants style;
if (CheckShowHeaders.CheckState == CheckState.Checked)
style = SftDirectoryHeadersStyleConstants.headersSftDirectoryButton;
else
style = SftDirectoryHeadersStyleConstants.headersSftDirectoryNone;
axSftDirectoryTV.Headers.Style = style;
axSftDirectoryDL.Headers.Style = style;
axSftDirectoryTV_Combo.Headers.Style = style;
axSftDirectoryDL_Combo.Headers.Style = style;
}
private void axSftDirectoryTV_CheckBoxClicked(object sender, AxSftDirectoryLib25._ISftDirectoryEvents_CheckBoxClickedEvent e) {
if (e.newValue != SftDirectoryCheckBoxValueConstants.checkboxSftDirectoryNo &&
e.newValue != SftDirectoryCheckBoxValueConstants.checkboxSftDirectoryYes) {
e.newValue = SftDirectoryCheckBoxValueConstants.checkboxSftDirectoryYes;
}
axSftDirectoryTV.CurrentFolder.SetSubFolderCheckBoxes(e.newValue, true);
axSftDirectoryTV.CurrentFolder.CheckBox = e.newValue;
axSftDirectoryTV.RootFolder.EvaluateSubFolderCheckBoxes(true);
}
private void axSftDirectoryTV_Combo_CheckBoxClicked(object sender, AxSftDirectoryLib25._ISftDirectoryEvents_CheckBoxClickedEvent e) {
if (e.newValue != SftDirectoryCheckBoxValueConstants.checkboxSftDirectoryNo &&
e.newValue != SftDirectoryCheckBoxValueConstants.checkboxSftDirectoryYes) {
e.newValue = SftDirectoryCheckBoxValueConstants.checkboxSftDirectoryYes;
}
axSftDirectoryTV_Combo.CurrentFolder.SetSubFolderCheckBoxes(e.newValue, true);
axSftDirectoryTV_Combo.CurrentFolder.CheckBox = e.newValue;
axSftDirectoryTV_Combo.RootFolder.EvaluateSubFolderCheckBoxes(true);
}
private void Form1_Load(object sender, System.EventArgs e) {
CheckTreeLines.CheckState = CheckState.Checked;
}
private void CloseButton_Click(object sender, System.EventArgs e) {
Application.Exit();
}
}
}