TreeView.StateImageList Propiedad

Definición

Obtiene o establece la lista de imágenes que se usa para indicar el estado del control TreeView y sus nodos.

public:
 property System::Windows::Forms::ImageList ^ StateImageList { System::Windows::Forms::ImageList ^ get(); void set(System::Windows::Forms::ImageList ^ value); };
public System.Windows.Forms.ImageList StateImageList { get; set; }
public System.Windows.Forms.ImageList? StateImageList { get; set; }
member this.StateImageList : System.Windows.Forms.ImageList with get, set
Public Property StateImageList As ImageList

Valor de propiedad

Lista ImageList utilizada para indicar el estado del control TreeView y sus nodos.

Ejemplos

En el ejemplo de código siguiente se muestra la StateImageList propiedad . Para ejecutar este ejemplo, pegue el código en un formulario Windows Forms y llame InitializeCheckTreeView desde el constructor o Load el controlador de eventos del formulario.

    TreeView^ checkTreeView;
private:
    void InitializeCheckTreeView()
    {
        checkTreeView = gcnew TreeView();

        // Show check boxes for the TreeView. This
        // will cause the StateImageList to be used.
        checkTreeView->CheckBoxes = true;

        // Create the StateImageList and add two images.
        checkTreeView->StateImageList = gcnew ImageList();
        checkTreeView->StateImageList->Images->Add(SystemIcons::Question);
        checkTreeView->StateImageList->Images->Add(SystemIcons::Exclamation);

        // Add some nodes to the TreeView and the TreeView to the form.
        checkTreeView->Nodes->Add("Node1");
        checkTreeView->Nodes->Add("Node2");
        this->Controls->Add(checkTreeView);
    }
TreeView checkTreeView;
private void InitializeCheckTreeView()
{
    checkTreeView = new TreeView();
    
    // Show check boxes for the TreeView. This
    // will cause the StateImageList to be used.
    checkTreeView.CheckBoxes = true;

    // Create the StateImageList and add two images.
    checkTreeView.StateImageList = new ImageList();
    checkTreeView.StateImageList.Images.Add(SystemIcons.Question);
    checkTreeView.StateImageList.Images.Add(SystemIcons.Exclamation);
    
    // Add some nodes to the TreeView and the TreeView to the form.
    checkTreeView.Nodes.Add("Node1");
    checkTreeView.Nodes.Add("Node2");
    this.Controls.Add(checkTreeView);
}
Private checkTreeView As TreeView

Private Sub InitializeCheckTreeView() 
    checkTreeView = New TreeView()
    
    ' Show check boxes for the TreeView.
    checkTreeView.CheckBoxes = True
    
    ' Create the StateImageList and add two images.
    checkTreeView.StateImageList = New ImageList()
    checkTreeView.StateImageList.Images.Add(SystemIcons.Question)
    checkTreeView.StateImageList.Images.Add(SystemIcons.Exclamation)
    
    ' Add some nodes to the TreeView and the TreeView to the form.
    checkTreeView.Nodes.Add("Node1")
    checkTreeView.Nodes.Add("Node2")
    Me.Controls.Add(checkTreeView)

End Sub

Comentarios

Para indicar el estado de , TreeNodeestablezca la StateImageList propiedad y también establezca la StateImageKey propiedad o StateImageIndex para cada TreeNode.

Las imágenes de estado mostradas en son TreeView de 16 x 16 píxeles de forma predeterminada. Establecer la ImageSize propiedad de StateImageList no tendrá ningún efecto sobre cómo se muestran las imágenes. Sin embargo, las imágenes de estado se cambian de tamaño según la configuración de PPP del sistema cuando el archivo app.config contiene la siguiente entrada:

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

Cuando la CheckBoxes propiedad de se TreeView establece en y la StateImageList propiedad se establecetrue, cada TreeNode una de las cuales está contenida en muestra TreeView las imágenes primera y segunda de StateImageList para indicar un estado no activado o comprobado, respectivamente. Debe establecer la StateImageList propiedad antes de agregar nodos a TreeView para evitar que las imágenes de estado se muestren en tiempo de diseño para los nodos que no tienen un conjunto de imágenes de estado.

Se aplica a