开发者

Disable label edit in a MouseClick action

In WinForms controls, how can I disable label edit when I click in an item of controls like ListView, TreeView, etc?, without disabling the editing capability (LabelEdit property)?

I want to do that because the following behaviour is anoying and problematic: "Select an item of one of those control, change the focus to other application, click back in the item" and then 开发者_运维知识库the label edit start automatically. Perhaps I want to only recover the focus and the selection.

Something similar happens when you change focus between controls of the same app, but in this situation I stop this behaviour cleaning the items selection at the moment of entering the control.

For the first described problem that is useless.


you can do that by handling BeforeLabelEdit of tree

    private void treeView1_BeforeLabelEdit(object sender, NodeLabelEditEventArgs e)
    {
//if you want to edit in some special case write your condition here
        e.CancelEdit = true;
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜