Autor Beitrag
Land-Gull
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 51

SuSe 9.2, WIN XP
D7 Enter
BeitragVerfasst: Mo 29.08.05 13:50 
Hi,
wie kann ich einen Tabelleneintrag z.B. rot machen?
Das soll automatisch passieren wenn bei einem Feld in der Spalte Umsatz eine Negative Zahl eingegeben wird. Feldtyp ist Währung.

Danke
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Mo 29.08.05 13:57 
Was für eine Tabelle? Wenn's nicht direkt geht, über OnDrawCell (o.ä.).
N8Falter74
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 53

Win XP
D7 Prof
BeitragVerfasst: Mo 29.08.05 13:58 
Hallo
ich habe das mal so gelöst:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
procedure Tfrm_MainForm.dbgrd_TrefferlisteDrawColumnCell(Sender: TObject;
  const Rect: TRect; DataCol: Integer; Column: TColumn;
  State: TGridDrawState);
begin
  if state = [] then
  begin
    if my_q_Arc.FieldList.IndexOf('State') <> -1 then
    begin
      case my_q_Arc.FieldByName('state').AsInteger of //  Column.Field.AsInteger of
        10: TDBGrid(sender).canvas.brush.color := $00e1ffe6;  // Weiss-Grün
        11: TDBGrid(sender).canvas.brush.color := $00e1ffe6;  // Weiss-Grün
      else TDBGrid(sender).canvas.brush.color := clWhite;
      end;
    end;
  end;
  if gdSelected in State then TDBGrid(sender).canvas.brush.color := clSkyBlue; // $00ffe3e1; // Weiss-Blau
  TDBGrid(sender).Canvas.Font.Color := clBlack;
  TDBGrid(sender).DefaultDrawColumnCell(rect, datacol, column,state);
end;


Zusätzlich sollte man noch die Eigenschaft 'DefaultDrawing' auf False setzen.

Hoffe es hilft dir.

Sebastian