TreeView仅在复选框处忽略双击 [英] TreeView ignore double click only at checkbox

查看:78
本文介绍了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.

如果您能帮助我,我表示感谢。

I appreciate if you can help me.

推荐答案

如果您只是想知道CheckBox中发生了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
}

这篇关于TreeView仅在复选框处忽略双击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆