Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5955765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:09:37+00:00 2026-05-22T18:09:37+00:00

So I have a TreeView in a C# windows form app. What I need

  • 0

So I have a TreeView in a C# windows form app. What I need is for some nodes to be “locked” so that they cannot be checked (or unchecked), based on a parameter.

What I am doing now is this:

private void tv_local_BeforeCheck(object sender, TreeViewCancelEventArgs e) {
    TNode node = (TNode)e.Node;
    //if a part node, cancel the action.
    if (node.Type == "Part") {
        e.Cancel = true;     
    }
    //if a locked node, cancel the action
    if (node.Locked == true) {
        e.Cancel = true;
    }
}

This code works great on a single click of the checkbox, but if the user double clicks on a checkbox, it still checks/unchecks.

I have tried playing with the nodeMouseDoubleClick event, but that doesnt really help, since I cannot cancel the event…

Is there any ideas out there how to cancel a double click event on a node?… or anything else?
Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:09:38+00:00Added an answer on May 22, 2026 at 6:09 pm

    This is a bug in the TreeView I think (http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/9d717ce0-ec6b-4758-a357-6bb55591f956/). You need to subclass the tree view and disable the double-click message in order to fix it. Like this:

    public class NoClickTree : TreeView
        {
            protected override void WndProc(ref Message m)
            {
                // Suppress WM_LBUTTONDBLCLK
                if (m.Msg == 0x203) { m.Result = IntPtr.Zero; }
                else base.WndProc(ref m);
            }              
        };
    

    Of course if you do this you’ll no longer be able to use the double-click metaphor in the tree-view for other things (such as double click a node to launch a property page, or something).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a treeview control in a Windows Forms project that has checkboxes turned
I have a regular .NET Windows Forms treeview control. The nodes are setup like
I have a TreeView control in a Windows Forms application that is displaying my
I have a control that inherits from TreeView (System.Windows.Controls.TreeView from WPF Framework) and it
I've got windows form app I'm developing, and my client wants a TreeView on
I have a TreeView in my Windows Form user interface. I want to fill
In my C# Windows Form Application, I have Treeview control with checkboxes. I want
I'd like to find a replacement for provided System.Windows.Form.Treeview. I need the following improvements
I've got a windows form object that contains 3 objects, a treeview, a richtextbox,
Okay, I have a TreeView that serves as a directory tree for Windows. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.