TreeView.StateImageList Property

 

Gets or sets the image list that is used to indicate the state of the TreeView and its nodes.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

member StateImageList : ImageList with get, set

Property Value

Type: System.Windows.Forms.ImageList

The ImageList used for indicating the state of the TreeView and its nodes.

To indicate the state of a TreeNode, set the StateImageList property and also set the StateImageKey or StateImageIndex property for each TreeNode.

The state images displayed in the TreeView are 16 x 16 pixels by default. Setting the ImageSize property of the StateImageList will have no effect on how the images are displayed. However, the state images are resized according to the system DPI setting when the app.config file contains the following entry:

<appSettings>
  <add key="EnableWindowsFormsHighDpiAutoResizing" value="true" />
</appSettings>

When the CheckBoxes property of a TreeView is set to true and the StateImageList property is set, each TreeNode that is contained in the TreeView displays the first and second images from the StateImageList to indicate an unchecked or checked state, respectively. You should set the StateImageList property before you add nodes to the TreeView to prevent state images being shown at design time for nodes that do not have a state image set.

The following code example demonstrates the StateImageList property. To run this example, paste the code into a Windows Form and call InitializeCheckTreeView from the form's constructor or Load event handler.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: