Einzelnen Beitrag anzeigen

SneakyBagels
(Gast)

n/a Beiträge
 
#28

AW: Große Probleme mit VirtualStringTree

  Alt 18. Jun 2017, 11:03
Ich habe eben mal ein bisschen mit toShowStaticText rumprobiert, bekomme das aber leider nicht hin, dass ich zwei Zeilen Text pro Node habe.
Aktuell verwende ich ja TargetCanvas.TextOut im OnDrawText zweimal, da klappt es. Winapi.Windows.DrawTextW wäre mir eigentlich lieber.

Aktuell ist es so
Delphi-Quellcode:
procedure TForm2.VSTDrawText(Sender: TBaseVirtualTree; TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; const Text: string; const CellRect: TRect;
 var DefaultDraw: Boolean);
var
 Data: TVSTData;
 DrawFormat: Cardinal;
 R: TRect;
 s: string;
begin
 DefaultDraw := False;
 R := CellRect;
 R.Left := R.Left + VST.Indent;

 Data := Node.GetData<TVSTData>;

 // TargetCanvas.TextOut(CellRect.Left, CellRect.Top + 2, Text);

 DrawFormat := DT_NOPREFIX or DT_VCENTER or DT_SINGLELINE;
 if Data.bHasDescription then
  R.Top := R.Top - 14;

 Winapi.Windows.DrawTextW(TargetCanvas.Handle, PWideChar(Text), Length(Text), R, DrawFormat);

 if Data.bHasDescription and (Column = 0) then
  begin
   // TargetCanvas.TextOut(CellRect.Left, CellRect.Top + 18, '123');
   s:='123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 '; // wird leider nicht komplett gezeichnet - nur "123 "
   R.Top := R.Top + 28;
   Winapi.Windows.DrawTextW(TargetCanvas.Handle, PWideChar(s), Length(s), R, DrawFormat);
  end;
end;

Geändert von SneakyBagels (18. Jun 2017 um 11:11 Uhr)
  Mit Zitat antworten Zitat