Stop toggle in treenode in winforms
i have a treeview in winforms . When i double click on treenode ,its childnode gets disappear .Again when i click on th开发者_JAVA百科at very node its child nodes gets expand. Any body please help me out.
If you want to disable double click alltogether you will have handle directly the WM_LBUTTONDBLCLK (0x0203). To do that create a MyTreeView control inheriting from System.Windows.Forms.TreeView and override the WndProc(ref Message m) method.
public class MyTreeView : TreeView
{
protected override void WndProc(ref Message m)
{
if (m.Msg == 0x203) { m.Result = IntPtr.Zero; } //Makes the control ignore double licks`
else base.WndProc(ref m);
}
};
This solution will disable completely double clicks on all the TreeView control. If you can live with that, this solution will do.
加载中,请稍侯......
精彩评论