Search code examples
c#treeviewexpandownerdrawn

C# ownerdrawn TreeView with custom expand area


I am using a TreeView with DrawMode = OwnerDrawAll. So I am supposed to be able to draw the nodes anyway I like in the DrawNode event I guess.

However, the region where the minus/plus for expansion/collapse would have been, still works. I want to paint a plus/minus image somewhere else, but it seems I am forced to paint it in the small predefined area, because Windows uses that area in any case.

My question: How can I define my own region responsible for expand/collapse? Or at least get rid of the predefined area, so that nothing happens when the user clicks in it?


Solution

  • Try turning off the property that controls that:

    treeView1.ShowPlusMinus = false;