Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Problem mit Vst spalte färben (https://www.delphipraxis.net/137005-problem-mit-vst-spalte-faerben.html)

youuu 12. Jul 2009 08:59


Problem mit Vst spalte färben
 
Hi,

Ich möchte bei einem besimmten Wert die Column einfärben in der, der Wert steht:

Ich dachte mir ich mach es so


Delphi-Quellcode:
procedure TFormKunden.VstPositionenGetText(Sender: TBaseVirtualTree;
  Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
  var CellText: string);
Var
  CustomerPos: TCustomerPositionen;
begin
  CustomerPos:= TCustomerPositionen(VstPositionen.GetNodeData(node)^ );
  case Column of
    0: Celltext:= CustomerPos.name;
    1: CellText:= IntToStr(CustomerPos.volume);
    2: CellText:= FloatToStr(CustomerPos.price);
    3: CellText:= FloatToStr(CustomerPos.price * CustomerPos.volume);
    4: If CustomerPos.status = 'aktive' Then
       Begin
         Color:= ClGreen;
         CellText:= CustomerPos.status;
       End
       Else
       Begin
         Color:= ClRed;
         CellText:= CustomerPos.status;
       End;
  end;
end;
Jedoch färbt er dabei leider nichts ein.

xZise 12. Jul 2009 11:06

Re: Problem mit Vst spalte färben
 
Naja aus dem ganz einfachen Grund, weil Color zum Formular gehört!

Genau deshalb gibt es das Ereignis "BeforeCellPaint".

MfG
xZise

youuu 12. Jul 2009 11:29

Re: Problem mit Vst spalte färben
 
Wie sag ich ihm dort aber, zeichne nur die Zeile 1 Grün wenn "xyz"und nicht das ganze VST?
Also wie ist der Befehl dafür?

xZise 12. Jul 2009 14:51

Re: Problem mit Vst spalte färben
 
Es gibt dort doch einen Spaltenparameter?

MfG
xZise

CoLT 14. Jul 2009 12:32

Re: Problem mit Vst spalte färben
 
Das musst du im OnBeforeCellPaint selber malen:
Delphi-Quellcode:
case Column of
  4:
     begin
       TargetCanvas.Brush.Color := clRed;
       TargetCanvas.FillRect(CellRect);
     end;
end;
mfg CoLT


Alle Zeitangaben in WEZ +1. Es ist jetzt 16:30 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz