Autor Beitrag
mexx
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Di 14.03.06 08:31 
Hallo,

ich habe ein DBGrid welches je nach Inhalten bestimmte farbliche Kennzeichen setzt. Nun möchte ich das anhand des Wertes SOLL_ZEIT entscheiden, ob der entsprechende Eintrag rot oder schwarz gemacht werden soll. Die Überprüfung stimmt, er macht auch alles schwarz und rot, was er machen soll.

ABER:

Die Feldbezeichnung macht er ebenso rot also den Spaltentitel.
Und er kommt aus dem Ereignis nicht mehr raus. Er zeichnet und zeichnet.


Wie kann ich das Problem lösen? Ziel ist es, die Inhalte der Spalte rot zu machen, dessen SOLL_ZEIT > 0 ist.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TZeitForm.DBGridAnzeigeCalcCellColors(Sender: TObject;
  Field: TField; State: TGridDrawState; Highlight: Boolean; AFont: TFont;
  ABrush: TBrush);

...

 if (Field.DataSet.FieldByName('SOLL_ZEIT').Value > '0') then
  begin
   Font.Color := clBlack;
  end
   else
    Font.Color := clRed;

...
raiguen
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 374

WIN 2000prof, WIN XP prof
D7EP, MSSQL, ABSDB
BeitragVerfasst: Di 14.03.06 09:15 
mexx Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Di 14.03.06 09:23 
Super, hat geholfen. THX