I'm trying to emulate Outlook 2013 left pane tree view menu for my application. I'm using CustomDraw because I only want to change some simple font and background properties.
Here's what I want:
However, I always get the default selected drawing for both selected and hot tracked nodes. I don't have Windows 7 or XP to see if this is the normal behavior or if it's something related with my OS (Windows 8).
Here's what I'm getting:
Here's my code:
procedure TMainForm.TreeView1CustomDrawItem(Sender: TCustomTreeView; Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean); begin if Node.Level = 1 then Sender.Canvas.Font.Size := Sender.Canvas.Font.Size + 2; if cdsHot in State then Sender.Canvas.Brush.Color := $00F7E6CD else if (cdsSelected in State) or (cdsFocused in State) or (cdsChecked in State) then Sender.Canvas.Brush.Color := $00F2F2F2 else Sender.Canvas.Brush.Color := $00DEDEDE; DefaultDraw := true; end;
How can I draw a different colored background for selected and hot items?