Goto Nodes 节点
Node Image 节点镜像
节点可以显示以下图标:
- 选择 Image - 当节点获得/失去焦点时自动切换的两个图标。
- 状态图像 - 任何自定义图标。
Select Image 选择图像
Specify image source 指定图像源
TreeList.SelectImageList 属性指定存储图像的有序(索引)集合。您可以使用以下图像集合:
-
ImageList — 管理 Image 对象的集合。
-
ImageCollection — 与 ImageList 类相比,提供了额外的功能。
-
SharedImageCollection — 在多个控件和表单之间共享图像。
-
SvgImageCollection — 存储矢量图像。
Assign images to nodes 将图像分配给节点
要指定特定节点中显示的图像的索引,请使用以下属性和事件:
-
TreeList.ImageIndexFieldName 属性 — 指定包含图像索引的数据字段的名称。该属性指定非聚焦和聚焦状态的图像索引(不能使用数据源字段指定两个图标)。
-
TreeListNode.ImageIndex 和 TreeListNode.SelectImageIndex 属性 — 分别获取或设置处于非聚焦和聚焦状态的节点图像索引。当节点获得/失去焦点时,图像会自动更改。
// Gets the select image index of the focused node.
int selectImageIndex = treeList1.GetFocusedRowCellValue(treeList1.ImageIndexFieldName);
- TreeList.GetSelectImage 事件 — 在显示节点之前触发,并允许您指定(覆盖)已处理节点的图像索引。
如果索引超出范围,则不会显示任何图像。
Respond to clicks 响应点击
单击选择图像时,将触发 TreeList.RowSelectImageClick 事件。
State Image 状态图像
State image: Specify image source 状态图像:指定图像源
TreeList.StateImageList 属性指定存储图像的有序(索引)集合。您可以使用以下图像集合:
- ImageList — 管理 Image 对象的集合。
- ImageCollection — 与 ImageList 类相比,提供了额外的功能。
- SharedImageCollection — 在多个控件和表单之间共享图像。
- SvgImageCollection — 存储矢量图像。
State image: Assign images to nodes 状态映像:将映像分配给节点
要指定特定节点中显示的图像的索引,请使用以下属性和事件:
-
TreeListNode.StateImageIndex 属性 — 获取或设置图像索引。
-
TreeList.GetStateImage 事件 — 在显示节点之前触发,并允许您指定(覆盖)已处理节点的图像索引。
如果索引超出范围,则不会显示任何图像。
State image: Respond to clicks 状态图片:响应点击次数
单击状态图像时,将触发 TreeList.RowStateImageClick 事件。
Node Image Location 节点映像位置
使用 TreeList.OptionsView.RowImagesShowMode 属性指定节点图像的显示位置:
- InIndent — 图像显示在缩进区域中。
- InCell — 图像显示在单元格内。
Draw Node Images 绘制节点图像
TreeList.CustomDrawNodeImages 事件提供对 GDI+/DirectX 绘图表面的访问,并允许您手动绘制节点图标。
有关如何使用绘图表面的更多信息,请参阅自定义绘制方案。