Imports Infragistics.Win Imports Infragistics.Win.UltraWinTree Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' Note: the Override objects are exposed as properties off ' the tree, the node and the nodes collection as well as ' items in the NodeLevelOverrides collection. This allows ' default settings to be specified for the tree, a node, ' a node's children or for a level in the tree. ' Specify that we want to use editors Me.ultraTree1.Override.UseEditor = DefaultableBoolean.True ' Set the default editor ' Note the EditorControl property can be used instead Me.ultraTree1.Override.Editor = New EditorWithMask() ' Specify when editor buttons will be show Me.ultraTree1.Override.ShowEditorButtons = ShowEditorButtons.ActiveAndHotTracked ' Set the appearance when the user is editing a node's label Me.ultraTree1.Override.LabelEditAppearance.BackColor = Color.Yellow ' Specify limits on the width and height of a node's label ' A value of -1 means use the default. A value of 0 means ' there is no limit. Me.ultraTree1.Override.MaxLabelHeight = 50 Me.ultraTree1.Override.MaxLabelWidth = 200 ' Specify that we don't want to support multiline nodelabels. ' Note: some editors (e.g. EditorWithMask) don't support ' multilien text. Me.ultraTree1.Override.Multiline = DefaultableBoolean.False ' Specify additonal spacing before and after nodes. ' A value of -1 means use the default. ' Me.ultraTree1.Override.NodeSpacingAfter = 3 Me.ultraTree1.Override.NodeSpacingBefore = 2 ' Set the default for nodes that are at level 2 ' (i.e. grandchild nodes of root modes) so that ' they don't have extra spacing. ' This overrides the default setting above. Me.ultraTree1.NodeLevelOverrides(2).NodeSpacingAfter = 0 Me.ultraTree1.NodeLevelOverrides(2).NodeSpacingBefore = 0 ' Set the default for nodes at the root level ' so that they dwon't use the editor. ' This overrides the default settings above. Me.ultraTree1.Nodes.Override.UseEditor = DefaultableBoolean.False ' Get a specific node by its key value. ' Note: Me will return the node that has that key ' from anywhere in the tree structure since keys are ' unique across the entire tree. Dim node As UltraTreeNode = Me.ultraTree1.GetNodeByKey("child node 1") ' Remove the height restriction for Me node ' This overrides any default settings above. node.Override.MaxLabelHeight = 0 ' Remove the width restriction for Me node's child nodes node.Nodes.Override.MaxLabelWidth = 0 End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinTree; private void button1_Click(object sender, System.EventArgs e) { // Note: the Override objects are exposed as properties off // the tree, the node and the nodes collection as well as // items in the NodeLevelOverrides collection. This allows // default settings to be specified for the tree, a node, // a node's children or for a level in the tree. // Specify that we want to use editors this.ultraTree1.Override.UseEditor = DefaultableBoolean.True; // Set the default editor // Note the EditorControl property can be used instead this.ultraTree1.Override.Editor = new EditorWithMask(); // Specify when editor buttons will be show this.ultraTree1.Override.ShowEditorButtons = ShowEditorButtons.ActiveAndHotTracked; // Set the appearance when the user is editing a node's label this.ultraTree1.Override.LabelEditAppearance.BackColor = Color.Yellow; // Specify limits on the width and height of a node's label // A value of -1 means use the default. A value of 0 means // there is no limit. this.ultraTree1.Override.MaxLabelHeight = 50; this.ultraTree1.Override.MaxLabelWidth = 200; // Specify that we don't want to support multiline nodelabels. // Note: some editors (e.g. EditorWithMask) don't support // multilien text. this.ultraTree1.Override.Multiline = DefaultableBoolean.False; // Specify additonal spacing before and after nodes. // A value of -1 means use the default. // this.ultraTree1.Override.NodeSpacingAfter = 3; this.ultraTree1.Override.NodeSpacingBefore = 2; // Set the default for nodes that are at level 2 // (i.e. grandchild nodes of root modes) so that // they don't have extra spacing. // This overrides the default setting above. this.ultraTree1.NodeLevelOverrides[2].NodeSpacingAfter = 0; this.ultraTree1.NodeLevelOverrides[2].NodeSpacingBefore = 0; // Set the default for nodes at the root level // so that they dwon't use the editor. // This overrides the default settings above. this.ultraTree1.Nodes.Override.UseEditor = DefaultableBoolean.False; // Get a specific node by its key value. // Note: this will return the node that has that key // from anywhere in the tree structure since keys are // unique across the entire tree. UltraTreeNode node = this.ultraTree1.GetNodeByKey("child node 1"); // Remove the height restriction for this node // This overrides any default settings above. node.Override.MaxLabelHeight = 0; // Remove the width restriction for this node's child nodes node.Nodes.Override.MaxLabelWidth = 0; } }