C#树视图忽略双击只在复选框 [英] c# treeview ignore double click only at checkbox
本文介绍了C#树视图忽略双击只在复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个复选框一个TreeView,我想禁用双击,只有当这是在复选框完成。
I have a treeview with checkbox, I'm trying to disable the double click only when this is done in the checkbox.
我找到了一种方法来完全禁用双击,但它不是我想要的。
I found a way to totally disable the double click but it was not what I wanted.
我AP preciate,如果你能帮助我。
I appreciate if you can help me.
推荐答案
如果你只是想知道一个DoubleClick事件的复选框发生了:
If you just want to know a DoubleClick event occurred from the CheckBox:
private void TreeViewDoubleClick(object sender, EventArgs e)
{
var localPosition = treeView.PointToClient(Cursor.Position);
var hitTestInfo = treeView.HitTest(localPosition);
if (hitTestInfo.Location == TreeViewHitTestLocations.StateImage)
return;
// ... Do whatever other processing you want
}
这篇关于C#树视图忽略双击只在复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文