Disable Checkbox in TreeView control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does anyone know how to disable a single check box in a Windows Forms
TreeView control.
 
Handle the BeforeCheck event and cancel any attempts to check it.

/claes
 
This will stop a user from checking the check box but the control does not
look disabled. I can set the foreground color of the text but not the text
box. Is there a way to get a handle to the actual text box.
 
I assume you mean checkbox (you wrote text box). The checkbox is just an
image in the state image list for the tree view (Windows generates 2 images
for you, one checked checkbox and one unchecked) so simply changing the
state image index for the node should work. Ofc, you'll need to add the
image for a disabled checkbox first. You can also replace the images with
your own if you'ld like. Here are some threads that might be of interest:

http://groups.google.com/groups?as_...81&as_maxd=12&as_maxm=6&as_maxy=2006&safe=off


/claes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top