TreeView中的HoverSelection(C#) [英] HoverSelection in TreeView (C#)
问题描述
在TreeView控件中,鼠标右键单击DOES选择指定的节点。但是,顶级节点以海军突出显示,而不是实际选择的节点。如果选择了节点,则首先通过鼠标左键单击,该节点将以正确的方式突出显示为海军。
我的问题是如何在TreeView控件中实现HoverSelection。不幸的是,我找不到"HoverSelection"。属性中的选项。
In a TreeView control, a mouse Right click DOES select the specified node. However, the top node is highlighted in navy, instead of the actually selected node. If the node is selected, first by a mouse Left click, the node is highlighted in navy properly. My question is how to implement a HoverSelection in TreeView control. Unfortunately I can't find a "HoverSelection" option in the properties.
谢谢
推荐答案
您好,
只需为NodeMouseHover事件注册TreeView并执行以下操作:
Just register the TreeView for the NodeMouseHover event and do this:
private void treeView1_NodeMouseHover(object sender, TreeNodeMouseHoverEventArgs e)
{
treeView1.SelectedNode = e.Node;
}
这篇关于TreeView中的HoverSelection(C#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!