Autor Beitrag
saxe66
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 104



BeitragVerfasst: Di 05.07.05 09:59 
Hallo an die Delphigemeinde,

ich habe eine für euch sicher simple Frage.
Wie kann ich auf einfache Weise jeder zweiten Zeile eines DBGrids eine andere Farbe zuordnen ?
Es geht mir nur um die Übersichtlichkeit der Tabelle.

Danke im Voraus ...
direction4delphi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 84

WIN 95, WIN 98, WIN ME, WIN NT, WIN 2000, WIN XP, VISTA
D2 Prof, D4 Prof,D2005 Prof, Delphi4Php
BeitragVerfasst: Di 05.07.05 10:45 
OnDrawColumnCell
DBGrid.Canvas.Brush.Color := clRed


mfg
MILLI
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Di 05.07.05 11:01 
Ein etwas angepasster Ausschnitt aus meiner Komponente zum Felder im Grid zu formatieren (auch auf meiner HP zu finden):
Im Ereignis DrawGridColumnCell:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
          if Odd(DBGrid.DataSource.DataSet.RecNo) then begin
            if DBGrid.Focused then begin
              if not (gdSelected in state) then begin
                DBGrid.Canvas.Brush.Color := clRed;
              end;
            end
            else begin
              if dgAlwaysShowSelection in DBGrid.Options then begin
                if not (gdSelected in state) then begin
                  DBGrid.Canvas.Brush.Color := clRed;
                end;
              end
              else begin
                DBGrid.Canvas.Brush.Color := clRed;
              end;
            end;
          end;