In my view it's a bug, because who would like to have a selection like this:
To fix it in a Virtual Tree View code (in my case v.5.1.4), go to the TBaseVirtualTree.PrepareCell
method (in my case line 25802) and check this nested procedure code (comments are mine):
procedure DrawBackground(State: Integer);
begin
// here the RowRect represents the row rectangle and InnerRect the cell
// rectangle, so there should be rather, if the toGridExtensions is NOT
// in options set or the toFullRowSelect is, then the selection will be
// drawn in the RowRect, otherwise in the InnerRect rectangle
if (toGridExtensions in FOptions.FMiscOptions) or (toFullRowSelect in FOptions.FSelectionOptions) then
DrawThemeBackground(Theme, PaintInfo.Canvas.Handle, TVP_TREEITEM, State, RowRect, nil)
else
DrawThemeBackground(Theme, PaintInfo.Canvas.Handle, TVP_TREEITEM, State, InnerRect, nil);
end;
To fix this issue modify the code this way:
procedure DrawBackground(State: Integer);
begin
// if the full row selection is disabled or toGridExtensions is in the MiscOptions, draw the selection
// into the InnerRect, otherwise into the RowRect
if not (toFullRowSelect in FOptions.FSelectionOptions) or (toGridExtensions in FOptions.FMiscOptions) then
DrawThemeBackground(Theme, PaintInfo.Canvas.Handle, TVP_TREEITEM, State, InnerRect, nil)
else
DrawThemeBackground(Theme, PaintInfo.Canvas.Handle, TVP_TREEITEM, State, RowRect, nil);
end;
And you'll get a selection like this:
The same applies also to the next DrawThemedFocusRect
nested procedure.
I have reported this problem as Issue 376
, which is fixed in revision r587
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…