Infragistics2.Win.UltraWinTree.v8.1
ImagePadding Property
See Also  Example
Infragistics.Win.UltraWinTree Namespace > UltraTree Class : ImagePadding Property

Gets/sets the ImagePadding which is the space before images.

Syntax

Visual Basic (Declaration) 
Public Property ImagePadding As Integer
C# 
public int ImagePadding {get; set;}

Remarks

Determines the amount of blank space before each image. This is used to seperate images in the UltraTreeNode.LeftImages and UltraTreeNode.RightImages collections.

Example

The following sample code initializes various properties on an UltraWinTree control and illustrates how to populate the tree.



Visual BasicCopy Code
    Imports Infragistics.Win.UltraWinTree

    Private Sub InitializeTreeControl()

        With Me.ultraTree1
            ' Set various properties on the tree control

            ' Specify whether the tree will scroll during a
            ' drag operation
            .AllowAutoDragScrolling = True

            ' Specify whether the tree will look for the
            ' next matching node as the user types.
            .AllowKeyboardSearch = True

            ' Specify the amount of milliseconds to wait
            ' before expanding a node during a drag
            ' operation.
            .AutoDragExpandDelay = 500

            ' Set the border style of the control
            .BorderStyle = Infragistics.Win.UIElementBorderStyle.InsetSoft

            ' Specify whether clicking anywhere on the
            ' row the node is on will select the node.
            .FullRowSelect = False

            ' Specify whether selected nodes remain
            ' highlighted when the tree loses focus.
            .HideSelection = True

            ' Specify the padding around images in pixels.
            .ImagePadding = 3

            ' Specify how many pixels to indent each
            ' node level.
            .Indent = 8

            ' Specify the default size of images that will
            ' appear to the left and right of a node's text.
            .LeftImagesSize = New Size(12, 12)
            .RightImagesSize = New Size(8, 8)

            ' Specify the style and color os the node
            ' connector lines.
            .NodeConnectorColor = Color.Red
            .NodeConnectorStyle = NodeConnectorStyle.Dotted

            ' Specify the string to be used to separate
            ' ancestor nodes when getting a node's
            ' 'FullPath' property. For example:
            'Me.ultraTree1..ActiveNode.FullPath
            .PathSeparator = "\"

            ' Specify whether scrollbars will be shown
            .Scrollable = Scrollbar.ShowIfNeeded

            ' Specify whether lines will appear between nodes
            .ShowLines = True

            ' Specify whether room for lines and expansion
            ' indicators will be reserved to the left of root
            ' nodes (i.e. nodes without a parent node).
            '
            ' Note: If the 'ShowLines' property is set to
            ' false then the root lines won't be visible
            ' even if the 'ShowRootLines' property is true.
            ' In that case just the expansion indicators
            ' will show.
            .ShowRootLines = True

            ' Add a root node
            Dim node As UltraTreeNode
            Dim childNode As UltraTreeNode

            node = .Nodes.Add("Node 1")

            ' Add some child nodes
            childNode = node.Nodes.Add("child node 1")
            childNode.Nodes.Add("child child 1")
            childNode.Nodes.Add("child child 2")
            childNode.Nodes.Add("child child 3")

            ' Add some grandchild nodes
            childNode = node.Nodes.Add("child node 2")
            childNode = node.Nodes.Add("child node 3")
            ' Disable the node
            childNode.Enabled = False
            childNode = node.Nodes.Add("child node 4")

            ' Add another root node
            node = .Nodes.Add("Node 2")

            ' Activate the last child node added
            .ActiveNode = childNode

            ' Bring the active node into view
            .ActiveNode.BringIntoView()

        End With

    End Sub
C#Copy Code
       using Infragistics.Win.UltraWinTree;

       
private void InitializeTreeControl()
       {

           
// Set various properties on the tree control

           
// Specify whether the tree will scroll during a
           
// drag operation
           
this.ultraTree1.AllowAutoDragScrolling = true;
           
           
// Specify whether the tree will look for the
           
// next matching node as the user types.
           
this.ultraTree1.AllowKeyboardSearch = true;

           
// Specify the amount of milliseconds to wait
           
// before expanding a node during a drag
           
// operation.
           
this.ultraTree1.AutoDragExpandDelay = 500;

           
// Set the border style of the control
           
this.ultraTree1.BorderStyle = Infragistics.Win.UIElementBorderStyle.InsetSoft;

           
// Specify whether clicking anywhere on the
           
// row the node is on will select the node.
           
this.ultraTree1.FullRowSelect = false;

           
// Specify whether selected nodes remain
           
// highlighted when the tree loses focus.
           
this.ultraTree1.HideSelection = true;

           
// Specify the padding around images in pixels.
           
this.ultraTree1.ImagePadding = 3;

           
// Specify how many pixels to indent each
           
// node level.
           
this.ultraTree1.Indent = 8;

           
// Specify the default size of images that will
           
// appear to the left and right of a node's text.
           
this.ultraTree1.LeftImagesSize = new Size(12,12);
           
this.ultraTree1.RightImagesSize = new Size(8,8);

           
// Specify the style and color os the node
           
// connector lines.
           
this.ultraTree1.NodeConnectorColor = Color.Red;
           
this.ultraTree1.NodeConnectorStyle = NodeConnectorStyle.Dotted;

           
// Specify the string to be used to separate
           
// ancestor nodes when getting a node's
           
// 'FullPath' property. For example:
           
//this.ultraTree1.ActiveNode.FullPath;
           
this.ultraTree1.PathSeparator = @"\";

           
// Specify whether scrollbars will be shown
           
this.ultraTree1.Scrollable = Scrollbar.ShowIfNeeded;

           
// Specify whether lines will appear between nodes
           
this.ultraTree1.ShowLines = true;

           
// Specify whether room for lines and expansion
           
// indicators will be reserved to the left of root
           
// nodes (i.e. nodes without a parent node).
           
//
           
// Note: If the 'ShowLines' property is set to
           
// false then the root lines won't be visible
           
// even if the 'ShowRootLines' property is true.
           
// In that case just the expansion indicators
           
// will show.
           
this.ultraTree1.ShowRootLines = true;

           
// Add a root node
           
UltraTreeNode node = this.ultraTree1.Nodes.Add("Node 1");

           
// Add some child nodes
           
UltraTreeNode childNode = node.Nodes.Add("child node 1");
           childNode.Nodes.Add(
"child child 1");
           childNode.Nodes.Add(
"child child 2");
           childNode.Nodes.Add(
"child child 3");

           
// Add some grandchild nodes
           
childNode = node.Nodes.Add("child node 2");
           childNode = node.Nodes.Add(
"child node 3");
           
// Disable the node
           
childNode.Enabled = false;
           childNode = node.Nodes.Add(
"child node 4");
           
           
// Add another root node
           
node = this.ultraTree1.Nodes.Add("Node 2");

           
// Activate the last child node added
           
this.ultraTree1.ActiveNode = childNode;

           
// Bring the active node into view
           
this.ultraTree1.ActiveNode.BringIntoView();

       }

See Also