如何在检查之前禁用treenode? [英] how to disable a treenode before it had been checked?
本文介绍了如何在检查之前禁用treenode?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好!我使用带有某些节点的树状视图,我希望其中的某些节点在检查之前应先禁用,例如enable = false.
我在树视图的Before_Checked事件中使用如下代码,但发现该节点仍然可以单击,有人可以告诉我如何进行更改并使其正常工作吗?
Hello!I use a treeview with some nodes,I want that some of these nodes shoule be disable like enable = false before they were checked.
I use codes like below,in the treeview Before_Checked events but I found the node still can be click ,could anyone tell me how to change it and let it work?THX a lot!
Private Sub aTree_BeforeCheck(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewCancelEventArgs) Handles aTree.BeforeCheck
Dim a As TreeNode
a = aTree.Nodes(0).Nodes(1)
a = e.Node
If e.Node.ForeColor = Color.Gray Then
e.Cancel = True
End If
End Sub
推荐答案
我在此处发布的链接适用于C#,但您可以从 ^ ].
The link that I post here is for C#, but you could get a general idea from it[^].
:sigh::sigh:仍然无法像我想要的那样工作,有人可以帮助我吗? :((
:sigh: :sigh: still not work like what I wanted,anyone could help me? :((
这篇关于如何在检查之前禁用treenode?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文