TreeView.StateImageList TreeView.StateImageList TreeView.StateImageList TreeView.StateImageList Property

정의

상태를 나타내는 데 사용 되는 이미지 목록을 가져오거나 설정 합니다.는 TreeView 와 해당 노드가 있습니다.Gets or sets the image list that is used to indicate the state of the TreeView and its nodes.

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; }
member this.StateImageList : System.Windows.Forms.ImageList with get, set
Public Property StateImageList As ImageList

속성 값

ImageList 의 상태를 나타내는 데는 TreeView 와 해당 노드가 있습니다.The ImageList used for indicating the state of the TreeView and its nodes.

예제

다음 코드 예제는 StateImageList 속성입니다.The following code example demonstrates the StateImageList property. 이 예제를 실행 하려면 호출을 Windows Form에 코드를 붙여넣은 InitializeCheckTreeView 폼의 생성자에서 또는 Load 이벤트 처리기입니다.To run this example, paste the code into a Windows Form and call InitializeCheckTreeView from the form's constructor or Load event handler.

    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

설명

상태를 나타내는 TreeNode설정 합니다 StateImageList 속성 설정를 StateImageKey 또는 StateImageIndex 각 속성이 TreeNode합니다.To indicate the state of a TreeNode, set the StateImageList property and also set the StateImageKey or StateImageIndex property for each TreeNode.

에 표시 되는 상태 이미지는 TreeView 기본적으로 16 x 16 픽셀입니다.The state images displayed in the TreeView are 16 x 16 pixels by default. 설정 합니다 ImageSize 의 속성을 StateImageList 이미지 표시 되는 방법에 영향을 주지 것입니다.Setting the ImageSize property of the StateImageList will have no effect on how the images are displayed. 그러나 상태 이미지 크기가 조정 됩니다 시스템 DPI 설정에 따라 app.config 파일에 다음 항목이 포함 된 경우: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>  

때를 CheckBoxes 의 속성을 TreeView 로 설정 됩니다 trueStateImageList 각 속성을 설정 TreeNode 에 포함 된를 TreeView 첫 번째와 두 번째 이미지를 표시는 StateImageList 나타내려면는 검사 되지 않은 상태 또는 선택 된, 각각.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. 설정 해야 합니다 StateImageList 속성 노드를 추가 하기 전에 TreeView 상태 이미지가 상태 이미지에 있지 않은 노드에 대 한 디자인 타임에 표시 되지 않도록 설정 합니다.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.

적용 대상