Home

SpeakComputers.com | Text-to-Speech Software

Natural sounding TTS voice support | Cepstral TTS voices | Text to MP3 | Natural Readers

Text to Speech Software Text to Speech Voices SpeakComputer Text to Speech Software

TreeView Control.

The Windows TreeView control is used to display a hierarchical collection or list of items. An example is commonly seen with Windows explorer.


Namespace: System.Windows.Forms
Assembly: Systems.Windows.Forms.dll

using System.Windows.Forms;
Calling: System.Windows.Forms.TreeView


Creating a new System.Windows.Forms.TreeView control.
TreeView treeView1 = new TreeView();

Adding the TreeView control to a Windows form.
this.Controls.Add(treeView1);

Placing the TreeView on the form at a specific location.
treeView1.Location = new Point(50, 50);

To add nodes to the TreeView control.
for (int i = 0; i < 20; i++) { TreeNode treeNode1 = new TreeNode(); treeNode1.Text = "TreeNode " + i.ToString(); this.treeView1.Nodes.Add(treeNode1); }

To add an event to determine which treenode has been selected.
this.treeView1.AfterSelect+=new TreeViewEventHandler(treeView1_AfterSelect);

To respond to the treenode which has been selected.
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { MessageBox.Show(e.Node.Text); }

To remove a selected TreeNode from the TreeView.
First we make sure that a TreeNode is selected, then we remove that TreNode from the TreeView.
if (this.treeView1.SelectedNode != null)
{
TreeNode treeNode = (TreeNode)this.treeView1.SelectedNode;
this.treeView1.Nodes.Remove(treeNode);

Top of page
Text to Speech Speech synthesis Software TTS Software
Copy Right 2006 SpeakComputers.com - All Rights Reserved.
About Privacy Policy TTS Resouces
Free Text to Speech software
Free Text to Speech Software