Skip to main content
 首页 » 编程设计

c#之同时选择不同 TreeView 中的2个节点

2024年02月20日13qlqwjy

我有 2 个 TreeView 控件,用户在 TreeView1 中选择一个节点,然后在 TreeView2 中选择一个节点。
问题是当他选择另一个 TreeView 的节点时,前一个节点离开了焦点,这样用户就不知道选择了哪个 TreeView。

有什么方法可以让焦点保持在 2 个 TreeNodes 上或更改 ForeColor/使所选节点加粗,以便所选节点仍然可见。

请您参考如下方法:

设置 TreeView 的 HideSelection属性为假:

Gets or sets a value indicating whether the selected tree node remains highlighted even when the tree view has lost the focus.