Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a StateImage in a TreeView?

Tags:

winforms

I have recently discovered this answer which allows me to identify if a user has clicked on a node or not. The TreeViewHitTestInfo returned by the HitTest() method contains a Location field of type TreeViewHitTestLocations with the following flags:

public enum TreeViewHitTestLocations
{
    None = 1,
    Image = 2,
    Label = 4,
    Indent = 8,
    PlusMinus = 16,
    RightOfLabel = 32,
    StateImage = 64,
    AboveClientArea = 256,
    BelowClientArea = 512,
    RightOfClientArea = 1024,
    LeftOfClientArea = 2048,
}

This is what I found through testing:

Screenshot

None:         White
Image:        Green
Label:        Yellow
Indent:       Dark blue
PlusMinus:    Red
RightOfLabel: Light blue

The ClientArea flags are in light gray, but I haven't been able to identify the StateImage one. What is a StateImage?

like image 730
Nolonar Avatar asked Dec 11 '25 10:12

Nolonar


1 Answers

As @Hans Passant mentioned in the comments: you need to set the StateImageList property to render the StateImage areas.

like image 75
Sal Avatar answered Dec 13 '25 17:12

Sal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!