AD
Administrator
Syncfusion Team
March 29, 2004 09:40 AM UTC
You should post this request in the Tools forum, or through Direct Trac selecting the Tools product.
DB
Daniel Bromand
June 30, 2004 02:05 PM UTC
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using Syncfusion.Windows.Forms.Tools;
namespace WindowsApplication1
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.ComboBox cmbDisplayOptions;
private Syncfusion.Windows.Forms.Tools.TreeViewAdv tvTests;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after
InitializeComponent call
//
InitComboBox();
InitTreeViewAdv();
}
private void InitComboBox()
{
ArrayList keys = new ArrayList();
keys.Add("aaa");
keys.Add("bbb");
keys.Add("ccc");
keys.Sort();
this.cmbDisplayOptions.DataSource = keys;
}
private void InitTreeViewAdv()
{
this.tvTests.Nodes.Clear();
this.tvTests.BeginUpdate(
Syncfusion.Windows.Forms.BeginUpdateOptions.SynchronizeScrollBars);
this.tvTests.ResetInsideScrollMargins();
ArrayList alData = new ArrayList();
for (int i=0;i<30;i++)
{
alData.Add(i);
}
foreach(int i in alData)
{
TreeNodeAdv newNode = new
TreeNodeAdv(i.ToString());
newNode.NodeData.Tag = i;
newNode.NodeData.ShowCheckBox = true;
this.tvTests.Nodes.Add(newNode);
}
this.tvTests.EndUpdate();
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.cmbDisplayOptions = new
System.Windows.Forms.ComboBox();
this.tvTests = new
Syncfusion.Windows.Forms.Tools.TreeViewAdv();
((System.ComponentModel.ISupportInitialize)(this.tvTests)).BeginInit();
this.SuspendLayout();
//
// cmbDisplayOptions
//
this.cmbDisplayOptions.Location = new
System.Drawing.Point(40, 16);
this.cmbDisplayOptions.Name = "cmbDisplayOptions";
this.cmbDisplayOptions.Size = new
System.Drawing.Size(121, 21);
this.cmbDisplayOptions.TabIndex = 0;
this.cmbDisplayOptions.Text = "comboBox1";
this.cmbDisplayOptions.SelectedIndexChanged += new
System.EventHandler(this.cmbDisplayOptions_SelectedIndexChanged);
//
// tvTests
//
this.tvTests.AllowDrop = true;
this.tvTests.BackColor =
System.Drawing.SystemColors.Window;
this.tvTests.BorderColor =
System.Drawing.Color.Black;
this.tvTests.Font = new
System.Drawing.Font("Verdana", 8F);
this.tvTests.HorizontalThumbTrack = true;
this.tvTests.HScrollPos = 0;
this.tvTests.Indent = 20;
this.tvTests.Location = new System.Drawing.Point(16,
56);
this.tvTests.Name = "tvTests";
this.tvTests.PathSeparator = "/";
this.tvTests.Size = new System.Drawing.Size(312,
368);
this.tvTests.TabIndex = 1;
this.tvTests.Text = "treeViewAdv1";
this.tvTests.VerticalThumbTrack = true;
this.tvTests.VScrollPos = 1;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5,
13);
this.ClientSize = new System.Drawing.Size(352, 446);
this.Controls.Add(this.tvTests);
this.Controls.Add(this.cmbDisplayOptions);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.tvTests)).EndInit();
this.ResumeLayout(false);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
try
{
Application.Run(new Form1());
}
catch (Exception ex)
{
MessageBox.Show(ex.Message,"AAA");
}
}
private void cmbDisplayOptions_SelectedIndexChanged(object
sender, System.EventArgs e)
{
this.InitTreeViewAdv();
}
}
}