Autor Beitrag
Becks16
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 405



BeitragVerfasst: So 15.07.07 20:34 
Hallo

Ich wollte man nach fragen ob das geht das ich in dem DBGrid die 1. Zeile meinetwegen Blau mache und die 2. denn rot und dann immer im wechsel. Funktioniert das ? wenn ja wie ?

mfg
martin


Moderiert von user profile iconChristian S.: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Mo 16.07.2007 um 20:05

_________________
Ich bin Dumm und weiss nichts :-)
Blawen
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 616
Erhaltene Danke: 33

Win XP, Vista, 7
Delphi 5 Prof., BDS 2006 Prof. RAD Studio XE
BeitragVerfasst: So 15.07.07 22:12 
Schau Dir mal den letzten Beitrag an: forum.dsdt.info/view...16368&highlight=

Das JvDBGrid (JVCL) kann dies übrigens von Hause aus.

_________________
Es kompilert, wir können ausliefern.
Und es kompiliert wieder - das Update ist fertig - bitte 100 Euro ;-)
Becks16 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 405



BeitragVerfasst: Mo 16.07.07 19:56 
mit dem quelltext macht er das , das alles eine farbe hat aber nicht das er das variiert

hier mal der code

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure Tf_umsatzuebersicht.DBGrid1DrawColumnCell(Sender: TObject;
  const Rect: TRect; DataCol: Integer; Column: TColumn;
  State: TGridDrawState);
begin
dbgrid1.Canvas.brush.color:=clactivecaption;
dbgrid1.Canvas.font.color:=clwhite;
dbgrid1.defaultdrawcolumnCell(rect, 1, column,state);

end;


mfg

_________________
Ich bin Dumm und weiss nichts :-)
Blawen
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 616
Erhaltene Danke: 33

Win XP, Vista, 7
Delphi 5 Prof., BDS 2006 Prof. RAD Studio XE
BeitragVerfasst: Mo 16.07.07 22:03 
user profile iconBecks16 hat folgendes geschrieben:
mit dem quelltext macht er das , das alles eine farbe hat aber nicht das er das variiert

hier mal der code

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure Tf_umsatzuebersicht.DBGrid1DrawColumnCell(Sender: TObject;
  const Rect: TRect; DataCol: Integer; Column: TColumn;
  State: TGridDrawState);
begin
dbgrid1.Canvas.brush.color:=clactivecaption;
dbgrid1.Canvas.font.color:=clwhite;
dbgrid1.defaultdrawcolumnCell(rect, 1, column,state);

end;


mfg

Nun, Dir fehlt schlicht ein Argument für das automatische wechseln der Farben.

Im gelinkten Beispiel wird dies z.B. so erledigt:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
// Feld-Wert prüfen und entsprechende Farbe wählen 
  bValue := qryIn.FieldByName('Status_geloescht').AsBoolean;
  IF bvalue = true 
  THEN 
    begin 
      dbgIn.Canvas.Brush.Color := clRed; 
      dbgIn.Canvas.Font.Color := clWhite; 
    end 
  ELSE 
    begin 
      dbgIn.Canvas.Brush.Color := clWhite; 
      dbgIn.Canvas.Font.Color := clBlack; 
    end
  // Felder zeichnen 
  dbgIn.DefaultDrawColumnCell(Rect, DataCol, Column, State);

_________________
Es kompilert, wir können ausliefern.
Und es kompiliert wieder - das Update ist fertig - bitte 100 Euro ;-)