Aracılığıyla paylaş


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 Formu'na yapıştırın ve formun oluşturucusundan veya Load olay işleyicisinden çağırınInitializeCheckTreeView.

    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 ayarlayın StateImageList ve 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 nasıl görüntülendiği üzerinde hiçbir etkiye sahip olmayacaktır. 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>

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

Şunlara uygulanır