Autor Beitrag
cartridge
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 209

Win XP
D4 Prof,D6 Prof
BeitragVerfasst: Mo 29.11.04 21:35 
ich hoffe, ich werde nicht wieder ge-lock-t, weil ich nicht in Datenbanken poste...

Hallo erstmal!

Weiß jemand, mit welchem Trick man Zeilen in einem DB Gitter einfärben kann? Alles scheint sich nämlich nur auf Spalten zu stützen! :cry:

Danke im Voraus
Gruß
Ingo
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 30.11.04 08:04 
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:
20:
procedure TDBGrid1.DrawGridColumnCell (Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn;  State: TGridDrawState);
begin
          if Odd(DBGrid1.DataSource.DataSet.RecNo) then begin
            if DBGrid1.Focused then begin
              if not (gdSelected in state) then begin
                DBGrid1.Canvas.Brush.Color := clYellow;
              end;
            end
            else begin
              if dgAlwaysShowSelection in DBGrid1.Options then begin
                if not (gdSelected in state) then begin
                  DBGrid1.Canvas.Brush.Color := clYellow;
                end;
              end
              else begin
                DBGrid1.Canvas.Brush.Color := clYellow;
              end;
            end;
          end;
end;

Ist ein angepasster Code-Schnipsel aus einer selbst gebastelten Komponente.
Ich hoffe, dass ich keinen Fehler beim Anpassen gemacht habe.
cartridge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 209

Win XP
D4 Prof,D6 Prof
BeitragVerfasst: Di 30.11.04 21:10 
Na, das werd ich doch gleich mal ausprobieren. Ich hatte nämlich nicht damit gerechnet, dass der Datensatz- Zeiger auch mit angepasst wird, wenn die entsprechnde Zeile "gemalt" wird!?

Gruß
Ingo
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: Mi 01.12.04 08:42 
Ich hätte auch die Komponente zur Verfügung gestellt, aber da sind noch ein paar lästige Fehler drin. Es funktioniert zwar und wird auch schon eingesetzt, aber wenn man z.B. eine andere verlinkte Komponente löscht gibts wunderbare Zugriffsverletzungen. :twisted:
Nächste Jahr geh ich da mal wieder ran.