TreeNode.StateImageKey TreeNode.StateImageKey TreeNode.StateImageKey TreeNode.StateImageKey Property

定義

取得或設定影像的索引鍵,用於在父代 TreeNodeTreeView 屬性設為 false 時,指示 CheckBoxes 的狀態。Gets or sets the key of the image that is used to indicate the state of the TreeNode when the parent TreeView has its CheckBoxes property set to false.

public:
 property System::String ^ StateImageKey { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.ImageKeyConverter))]
[System.Windows.Forms.RelatedImageList("TreeView.StateImageList")]
public string StateImageKey { get; set; }
member this.StateImageKey : string with get, set
Public Property StateImageKey As String

屬性值

用來表示 TreeNode 狀態的影像索引鍵。The key of the image that is used to indicate the state of the TreeNode.

備註

這個屬性所傳回的影像索引鍵包含在父StateImageList TreeView控制項的屬性中。The image key that is returned by this property is contained in the StateImageList property of the parent TreeView control.

如果父系TreeView已啟用核取方塊StateImageKey ,則會忽略,而節點會顯示父代TreeView中的StateImageList第一個或第二個影像,分別表示未核取或已檢查的狀態。If the parent TreeView has check boxes enabled, the StateImageKey is ignored and the node will display the first or second image in the StateImageList set on the parent TreeView to indicate an unchecked or checked state, respectively. 切換屬性並不會影響的值StateImageKeyCheckedToggling the Checked property does not affect the value of the StateImageKey.

StateImageKeyStateImageIndex屬性是互斥的,也就是說,如果已設定,則會忽略另一個。The StateImageKey and StateImageIndex properties are mutually exclusive, meaning if one is set, the other is ignored. 如果您設定了StateImageKey屬性StateImageIndex ,屬性會自動設為-1。If you set the StateImageKey property, the StateImageIndex property is automatically set to -1. 或者,如果您設定StateImageIndexStateImageKey會自動設為空字串("")。Alternatively, if you set StateImageIndex, StateImageKey is automatically set to an empty string (""). 您應該將設定StateImageKey為包含0到14之間對應索引的影像。You should set the StateImageKey to an image with a corresponding index between 0 and 14. 您可以將設定StateImageKey為索引值大於14的映射(不會擲回例外狀況),但不會顯示影像。You can set the StateImageKey to an image with an index value greater than 14 (an exception will not be thrown), but the image may not be displayed

適用於

另請參閱