I have a TreeView that allows users to select certain elements of hierarchical data by checking or un-checking each item's checkbox. Currently I disable the box on nodes that have children using the checkbox hiding technique from another question, like so:
☑ Node 1
☐ Node 2
• Node 3
☑ Node 3.1
☑ Node 3.2
• Node 4
☐ Node 4.1
☑ Node 4.2
But a better solution would be to use tri-state check boxes for the parent nodes, like this:
☑ Node 1
☐ Node 2
☑ Node 3
☑ Node 3.1
☑ Node 3.2
☒ Node 4
☐ Node 4.1
☑ Node 4.2
Since this functionality was available in Win32, my question is how to do this without drawing the boxes myself (e.g., as a user-drawn control or using an image list). I am not familiar with the Win32 API at all; how would one extend the technique linked above to enable tri-state checboxes on a managed TreeView control?