TreeView.StateImageList Özellik

Tanım

ve düğümlerinin TreeView durumunu belirtmek için kullanılan görüntü listesini alır veya ayarlar.

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

Özellik Değeri

ImageList ve düğümlerinin TreeView durumunu belirtmek için kullanılır.

Örnekler

Aşağıdaki kod örneği özelliğini gösterir StateImageList . Bu örneği çalıştırmak için, kodu bir Windows Formuna yapıştırın ve formun oluşturucusundan veya Load olay işleyicisinden çağrısı InitializeCheckTreeView alın.

    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

Açıklamalar

durumunu TreeNodebelirtmek için özelliğini ve StateImageList ayrıca her TreeNodeiçin or StateImageIndex özelliğini ayarlayınStateImageKey.

içinde TreeView görüntülenen durum görüntüleri varsayılan olarak 16 x 16 pikseldir. özelliğinin ImageSizeStateImageList ayarlanması, görüntülerin görüntülenme şeklini etkilemeyecektir. Ancak, app.config dosyası aşağıdaki girişi içerdiğinde durum görüntüleri sistem DPI ayarına göre yeniden boyutlandırılır:

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

CheckBoxes bir TreeView özelliği olarak ayarlandığında true ve StateImageList özelliği ayarlandığında, içinde TreeView yer alan her TreeNode biri, işaretlenmemiş veya denetlenmiş bir durumu belirtmek için içindeki ilk ve ikinci görüntüleri StateImageList sırasıyla görüntüler. Durum görüntüsü ayarlı olmayan düğümler TreeView için tasarım zamanında durum görüntülerinin gösterilmesini önlemek için öğesine düğüm eklemeden önce özelliğini ayarlamanız StateImageList gerekir.

Şunlara uygulanır