我使用TVirtualStringTree + toUseExplorerTheme + toThemeAware进行漂亮的显示。但我需要更改所选项目的颜色和悬停项目。 怎么办呢?
答案 0 :(得分:0)
感谢大家! 解决了以下问题:
SelectionBlendFactor:= 0 toUseExplorerTheme + toThemeAware:= False
procedure MyForm.vtLogBeforeItemErase(Sender: TBaseVirtualTree;
TargetCanvas: TCanvas; Node: PVirtualNode; ItemRect: TRect;
var ItemColor: TColor; var EraseAction: TItemEraseAction);
begin
inherited;
if not Assigned(Node) then
Exit;
EraseAction := eaColor;
if not Odd(Node.Index) then
ItemColor := $00FAF7F5
else
ItemColor := vtLog.Color;
if vsSelected in Node.States then begin
if vtLog.Focused then
ItemColor := $00D6B693//$E1B959
else
ItemColor := $00E9E1D8;
end
else
if vtLog.Focused and Assigned(vtLog.HotNode) and (vtLog.HotNode.Index = Node.Index) then begin
ItemColor := $00FBECDC;
end;
end;
非常漂亮的绘画和工作。