C#設定 Windows Form TreeView 控制項的圖示
C#設定 Windows Form TreeView 控制項的圖示
資料來源:https://msdn.microsoft.com/zh-tw/library/aa983725(v=vs.71).aspx
01.設定TreeView和imageList的關聯
‘ Visual Basic
TreeView1.ImageList = ImageList1
// C#
treeView1.ImageList = imageList1;
// C++
treeView1->ImageList = imageList1;
02.
‘ Visual Basic
‘ (Assumes that ImageList1 contains at least two images and
‘ the TreeView control contains a selected image.)
TreeView1.SelectedNode.ImageIndex = 0
TreeView1.SelectedNode.SelectedImageIndex = 1
// C#
// (Assumes that imageList1 contains at least two images and
// the TreeView control contains a selected image.)
treeView1.SelectedNode.ImageIndex = 0;
treeView1.SelectedNode.SelectedImageIndex = 1;
// C++
// (Assumes that imageList1 contains at least two images and
// the TreeView control contains a selected image.)
treeView1->SelectedNode->ImageIndex = 0;
treeView1->SelectedNode->SelectedImageIndex = 1;