在我看來這是一個錯誤,因爲誰願意要選擇這樣的:
要修復它在虛擬樹視圖代碼(在我的情況v.5.1.4) ,轉到TBaseVirtualTree.PrepareCell
方法(在我的案件25802線),並檢查該嵌套程序代碼(註釋礦):
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;
要解決此問題,修改代碼是這樣的:
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;
,你會得到一個選擇是這樣的:
這同樣也適用於未來DrawThemedFocusRect
嵌套的過程。
我已將此問題報告爲Issue 376
,該問題已在revision r587
中修復。
非常好。謝謝。 –
不客氣!無論如何,我之前提出的解決方案存在['問題](http://stackoverflow.com/q/20637534/960757),所以請更新到修訂版r587進行修復。 – TLama