![]() |
VirtualStringTree Text with multiColor
Hello , please i need all your help in this :
Suppose i have this Text on VirtualStringTree cell : 'HELLO' how can i give Each character a different Color like this : HELLO many thanks |
AW: VirtualStringTree Text with multiColor
Maybe you could use the
Delphi-Quellcode:
Event of the VST. And I think there you could change the
OnDrawText
Delphi-Quellcode:
of the TargetCanvas for each letter.
Canvas.Font.Color
|
AW: VirtualStringTree Text with multiColor
Zitat:
|
AW: VirtualStringTree Text with multiColor
Maybe you could do it like this:
Delphi-Quellcode:
But I really don't know if this is the right and/or fastest way to do this.
procedure TMainFrm.MainVSTDrawText(Sender: TBaseVirtualTree; TargetCanvas: TCanvas; Node: PVirtualNode;
Column: TColumnIndex; const Text: string; const CellRect: TRect; var DefaultDraw: Boolean); var i, TotalWidth : Integer; begin DefaultDraw := False; if Node.Index = 1 then begin TotalWidth := 0; for i := 0 to Length(Text) - 1 do begin if (i mod 2 = 0) then TargetCanvas.Font.Color := clBlue else TargetCanvas.Font.Color := clRed; TargetCanvas.TextOut(CellRect.Left + TotalWidth, CellRect.Top, Text[i]); Inc(TotalWidth, TargetCanvas.TextWidth(Text[i])); end; end else DefaultDraw := True; end; Happy testing. :wink: |
AW: VirtualStringTree Text with multiColor
Liste der Anhänge anzeigen (Anzahl: 1)
Sorry for double posting, but I forgot the sample picture.
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:31 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz