procedure TForm2.vstDrawText(Sender: TBaseVirtualTree; TargetCanvas: TCanvas;
Node: PVirtualNode; Column: TColumnIndex; const Text: string;
const CellRect: TRect; var DefaultDraw: Boolean);
var ss1,ss2:string; POS:Integer; fc:TColor;fs:Integer;
begin
case Column of
0,1,3:
begin
//First, store the default font size and color number
fc:=TargetCanvas.Font.Color;
fs:=TargetCanvas.Font.Size;
DefaultDraw:=false;
ss1:=Text.Substring(0,3);
ss2:=Text.Substring(3);
pos:=5;
TargetCanvas.Font.Color:=clRed;
TargetCanvas.Font.size:=fs+2;
TargetCanvas.TextOut(CellRect.left+POS,4,ss1);
pos:=pos+targetcanvas.TextWidth(ss1)+2;
TargetCanvas.Font.Color:=fc;
TargetCanvas.Font.size:=fs;
TargetCanvas.TextOut(CellRect.left+POS,5,ss2);
end;
end;
end;
1条答案
按热度按时间2nbm6dog1#
您可以在事件“OndrawText”中编写以下代码: