Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在vb.net中使树状视图中的复选框只读_Vb.net - Fatal编程技术网

如何在vb.net中使树状视图中的复选框只读

如何在vb.net中使树状视图中的复选框只读,vb.net,Vb.net,有人能帮我吗,因为我想禁用树视图中的复选框,同时能够在树视图中滚动。创建一个新类并复制下面的代码 Imports System.Windows.Forms public class MyTreeView Inherits Treeview Protected Overrides Sub WndProc(ByRef m as system.Windows.Forms.Message) if m.Msg = &H203 THEN m.Result = IntPtr.Zero else MyB

有人能帮我吗,因为我想禁用树视图中的复选框,同时能够在树视图中滚动。

创建一个新类并复制下面的代码

Imports System.Windows.Forms
public class MyTreeView
Inherits Treeview
Protected Overrides Sub WndProc(ByRef m as system.Windows.Forms.Message)
if m.Msg = &H203 THEN
m.Result = IntPtr.Zero
else
MyBase.WndProc(m)
End If
End Sub
编译您的项目,然后从工具箱中拖放此新控件,或者转到设计器并将System.Windows.Forms.Treeview重命名为MyTreeview

转到你的vb代码,在BeforeCheck事件中说e.Cancel=true

完成


如果您需要任何帮助,请发布您的评论

winforms?wpf?asp.net?非常感谢,它很有魅力。