using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace PropertyTree.Demo
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private WRM.Windows.Forms.PropertyTree propertyTree1;
private WRM.Windows.Forms.PropertyPane ppPane1;
private WRM.Windows.Forms.PropertyPane ppPane2;
private WRM.Windows.Forms.PropertyPane ppPane4;
private WRM.Windows.Forms.PropertyPane ppPane5;
private PropertyTree.Demo.CustomPane ppPane6;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.CheckBox checkBox2;
private System.Windows.Forms.CheckBox checkBox3;
private System.Windows.Forms.CheckBox checkBox4;
private System.Windows.Forms.MonthCalendar monthCalendar1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button button4;
private WRM.Windows.Forms.PropertyPane ppSharedPanes;
private WRM.Windows.Forms.PropertyPane ppPane3;
private System.Windows.Forms.CheckBox checkBox5;
/// <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()
{
this.propertyTree1 = new WRM.Windows.Forms.PropertyTree();
this.ppPane1 = new WRM.Windows.Forms.PropertyPane();
this.label1 = new System.Windows.Forms.Label();
this.ppPane4 = new WRM.Windows.Forms.PropertyPane();
this.button3 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.ppPane5 = new WRM.Windows.Forms.PropertyPane();
this.monthCalendar1 = new System.Windows.Forms.MonthCalendar();
this.checkBox4 = new System.Windows.Forms.CheckBox();
this.checkBox3 = new System.Windows.Forms.CheckBox();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.ppPane2 = new WRM.Windows.Forms.PropertyPane();
this.label3 = new System.Windows.Forms.Label();
this.ppPane6 = new PropertyTree.Demo.CustomPane();
this.ppSharedPanes = new WRM.Windows.Forms.PropertyPane();
this.button4 = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label();
this.ppPane3 = new WRM.Windows.Forms.PropertyPane();
this.checkBox5 = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.propertyTree1)).BeginInit();
this.propertyTree1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.ppPane1)).BeginInit();
this.ppPane1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.ppPane4)).BeginInit();
this.ppPane4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.ppPane5)).BeginInit();
this.ppPane5.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.ppPane2)).BeginInit();
this.ppPane2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.ppPane6)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ppSharedPanes)).BeginInit();
this.ppSharedPanes.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.ppPane3)).BeginInit();
this.ppPane3.SuspendLayout();
this.SuspendLayout();
//
// propertyTree1
//
this.propertyTree1.Dock = System.Windows.Forms.DockStyle.Fill;
this.propertyTree1.ImageList = null;
this.propertyTree1.Indent = 19;
this.propertyTree1.Name = "propertyTree1";
this.propertyTree1.SelectedImageIndex = -1;
this.propertyTree1.ShowLines = true;
this.propertyTree1.ShowPlusMinus = true;
this.propertyTree1.ShowRootLines = true;
this.propertyTree1.Size = new System.Drawing.Size(768, 455);
this.propertyTree1.SplitterColor = System.Drawing.SystemColors.AppWorkspace;
this.propertyTree1.SplitterLeft = 184;
this.propertyTree1.TabIndex = 0;
this.propertyTree1.PaneNodes.Add(this.ppPane1, 0, -1, -1);
this.propertyTree1.PaneNodes.Add(this.ppPane2, 1, -1, -1);
this.propertyTree1.PaneNodes.Add(this.ppSharedPanes, 2, -1, -1);
this.propertyTree1.PaneNodes.Add(this.ppPane3, 3, -1, -1);
//
// ppPane1
//
this.ppPane1.Controls.AddRange(new System.Windows.Forms.Control[] {
this.label1});
this.ppPane1.ImageIndex = -1;
this.ppPane1.Name = "ppPane1";
this.ppPane1.SelectedImageIndex = -1;
this.ppPane1.Text = "Basic panes";
this.ppPane1.PaneNodes.Add(this.ppPane4, 0, -1, -1);
this.ppPane1.PaneNodes.Add(this.ppPane5, 1, -1, -1);
//
// label1
//
this.label1.Location = new System.Drawing.Point(12, 12);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(556, 148);
this.label1.TabIndex = 0;
this.label1.Text = "label1";
//
// ppPane4
//
this.ppPane4.Controls.AddRange(new System.Windows.Forms.Control[] {
this.button3,
this.button2,
this.button1,
this.label2});
this.ppPane4.ImageIndex = -1;
this.ppPane4.Name = "ppPane4";
this.ppPane4.SelectedImageIndex = -1;
this.ppPane4.Text = "Pane 1";
//
// button3
//
this.button3.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.button3.Location = new System.Drawing.Point(12, 104);
this.button3.Name = "button3";
this.button3.TabIndex = 3;
this.button3.Text = "button3";
//
// button2
//
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.button2.Location = new System.Drawing.Point(12, 72);
this.button2.Name = "button2";
this.button2.TabIndex = 2;
this.button2.Text = "button2";
//
// button1
//
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.button1.Location = new System.Drawing.Point(12, 40);
this.button1.Name = "button1";
this.button1.TabIndex = 1;
this.button1.Text = "button1";
//
// label2
//
this.label2.Location = new System.Drawing.Point(12, 8);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(320, 23);
this.label2.TabIndex = 0;
this.label2.Text = "label2";
//
// ppPane5
//
this.ppPane5.Controls.AddRange(new System.Windows.Forms.Control[] {
this.monthCalendar1,
this.checkBox4,
this.checkBox3,
this.checkBox2,
this.checkBox1});
this.ppPane5.ImageIndex = -1;
this.ppPane5.Name = "ppPane5";
this.ppPane5.SelectedImageIndex = -1;
this.ppPane5.Text = "Pane 2";
//
// monthCalendar1
//
this.monthCalendar1.Location = new System.Drawing.Point(88, 140);
this.monthCalendar1.Name = "monthCalendar1";
this.monthCalendar1.TabIndex = 4;
//
// checkBox4
//
this.checkBox4.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.checkBox4.Location = new System.Drawing.Point(12, 92);
this.checkBox4.Name = "checkBox4";
this.checkBox4.Size = new System.Drawing.Size(348, 20);
this.checkBox4.TabIndex = 3;
this.checkBox4.Text = "checkBox4";
//
// checkBox3
//
this.checkBox3.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.checkBox3.Location = new System.Drawing.Point(12, 64);
this.checkBox3.Name = "checkBox3";
this.checkBox3.Size = new System.Drawing.Size(348, 20);
this.checkBox3.TabIndex = 2;
this.checkBox3.Text = "checkBox3";
//
// checkBox2
//
this.checkBox2.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.checkBox2.Location = new System.Drawing.Point(12, 36);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(348, 20);
this.checkBox2.TabIndex = 1;
this.checkBox2.Text = "checkBox2";
//
// checkBox1
//
this.checkBox1.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.checkBox1.Location = new System.Drawing.Point(12, 8);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(348, 20);
this.checkBox1.TabIndex = 0;
this.checkBox1.Text = "checkBox1";
//
// ppPane2
//
this.ppPane2.Controls.AddRange(new System.Windows.Forms.Control[] {
this.label3});
this.ppPane2.ImageIndex = -1;
this.ppPane2.Name = "ppPane2";
this.ppPane2.SelectedImageIndex = -1;
this.ppPane2.Text = "Custom panes";
this.ppPane2.PaneNodes.Add(this.ppPane6, 0, -1, -1);
//
// label3
//
this.label3.Location = new System.Drawing.Point(12, 12);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(556, 148);
this.label3.TabIndex = 1;
this.label3.Text = "label3";
//
// ppPane6
//
this.ppPane6.ImageIndex = -1;
this.ppPane6.Location = new System.Drawing.Point(188, 21);
this.ppPane6.Name = "ppPane6";
this.ppPane6.SelectedImageIndex = -1;
this.ppPane6.Size = new System.Drawing.Size(580, 434);
this.ppPane6.TabIndex = 4;
this.ppPane6.Text = "Custom pane 1";
//
// ppSharedPanes
//
this.ppSharedPanes.Controls.AddRange(new System.Windows.Forms.Control[] {
this.button4,
this.label4});
this.ppSharedPanes.ImageIndex = -1;
this.ppSharedPanes.Name = "ppSharedPanes";
this.ppSharedPanes.SelectedImageIndex = -1;
this.ppSharedPanes.Text = "Shared panes";
//
// button4
//
this.button4.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.button4.Location = new System.Drawing.Point(12, 80);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(136, 23);
this.button4.TabIndex = 3;
this.button4.Text = "Add children...";
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// label4
//
this.label4.Location = new System.Drawing.Point(12, 12);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(556, 60);
this.label4.TabIndex = 2;
this.label4.Text = "The child panes of this pane are all instances of a class derived from SharedProp" +
"ertyPane. They cannot be added at design-time. Click the button below to add a" +
" new instance as a child of this PropertyPane.";
//
// ppPane3
//
this.ppPane3.Controls.AddRange(new System.Windows.Forms.Control[] {
this.checkBox5});
this.ppPane3.ImageIndex = -1;
this.ppPane3.Name = "ppPane3";
this.ppPane3.SelectedImageIndex = -1;
this.ppPane3.Text = "Bells and whistles";
//
// checkBox5
//
this.checkBox5.Location = new System.Drawing.Point(24, 12);
this.checkBox5.Name = "checkBox5";
this.checkBox5.Size = new System.Drawing.Size(332, 24);
this.checkBox5.TabIndex = 0;
this.checkBox5.Text = "Auto-navigate";
this.checkBox5.CheckedChanged += new System.EventHandler(this.checkBox5_CheckedChanged);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(768, 455);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.propertyTree1});
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.propertyTree1)).EndInit();
this.propertyTree1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.ppPane1)).EndInit();
this.ppPane1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.ppPane4)).EndInit();
this.ppPane4.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.ppPane5)).EndInit();
this.ppPane5.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.ppPane2)).EndInit();
this.ppPane2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.ppPane6)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ppSharedPanes)).EndInit();
this.ppSharedPanes.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.ppPane3)).EndInit();
this.ppPane3.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private static int i=0;
private void button4_Click(object sender, System.EventArgs e)
{
PaneNodeData pnd = new PaneNodeData();
pnd.MyString = GetSomeRandomText();
ppSharedPanes.PaneNodes.Add(
typeof(SharedPane),
"New shared pane (" + i++ + ")",
pnd);
}
private string GetSomeRandomText()
{
switch(i % 4)
{
case 0:
return "For score and seven years ago...";
case 1:
return "Read my lips - no new taxes!";
case 2:
return "WMD? Oh yeah, we got rid of those *years* ago!";
case 3:
return "I'd much rather be pissed off than be right!";
}
return "How did this happen?";
}
private void checkBox5_CheckedChanged(object sender, System.EventArgs e)
{
if(propertyTree1.AutoNavigate)
{
propertyTree1.AutoNavigate = false;
propertyTree1.ShowLines = true;
propertyTree1.ShowPlusMinus = true;
propertyTree1.ShowRootLines = true;
}
else
{
propertyTree1.AutoNavigate = true;
}
}
}
}