Autor Beitrag
Ant
Hält's aus hier
Beiträge: 2



BeitragVerfasst: Mo 29.09.03 08:10 
Hi. Ich habe im Detailband meines Quickreports nicht nur TQRDBText-Komponenten, sondern auch ein QRShape. In der ausgelesenen Datenbank sind Farbinformationen als Integerwerte hinterlegt. Nun wird ja bei Ausführen der Methode Preview die druckbare Vorschau gezeigt und da ist natürlich jedes Shape weiß, so wie das ursprüngliche. Wie kann ich nun jedem einzelnen Shape die entsprechende aus der Datenbank gelesene Farbe zuweisen?
JoJo
Hält's aus hier
Beiträge: 2


D6 Prof
BeitragVerfasst: So 05.10.03 16:14 
Versuche doch mal folgenden Source einzubinden.
Ist die ONDrawColumnCell-Routine in einem normalen DBGrid, damit
habe ich schon mal ein Grid eingefärbt.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
Procedure TMain_Form.DBG_InhaltLinksDrawColumnCell(Sender: TObject;const Rect:TRect;
          DataCol:Integer;Column:TColumn;State:TGridDrawState);
Begin

  Case DAT_Module.TAB_MaterialLinks.FieldByName('M_Farbe').AsInteger of
     1  :  DBG_InhaltLinks.Canvas.Brush.Color := $000BEFF4; {Gelb}
     2  :  DBG_InhaltLinks.Canvas.Brush.Color := $0040FF00; {Grün}
     3  :  DBG_InhaltLinks.Canvas.Brush.Color := $004848FF; {Rot}
     4  :  DBG_InhaltLinks.Canvas.Brush.Color := $00FF80FF; {Lila}
     5  :  DBG_InhaltLinks.Canvas.Brush.Color := clAqua;    {Aqua}
     6  :  DBG_InhaltLinks.Canvas.Brush.Color := clSilver;  {Grau}
     7  :  DBG_InhaltLinks.Canvas.Brush.Color := $008080FF; {Orange}
     8  :  DBG_InhaltLinks.Canvas.Brush.Color := $00FD7A77; {Blau}
     9  :  DBG_InhaltLinks.Canvas.Brush.Color := $0000A6A6; {Olive}
    10  :  DBG_InhaltLinks.Canvas.Brush.Color := $00FFF9F9; {Weiß}
  //     2  :  DBG_InhaltLinks.Canvas.Font.Color := clGreen;
  End;
  DBG_InhaltLinks.DefaultDrawColumnCell(Rect, DataCol, Column, State);

 End;
[/delphi]
Klabautermann
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Veteran
Beiträge: 6366
Erhaltene Danke: 60

Windows 7, Ubuntu
Delphi 7 Prof.
BeitragVerfasst: Mo 06.10.03 09:40 
Hallo,

wenn du die Farbe direcht als interger gespeichert hast, dann ist es so efektiver:
ausblenden Delphi-Quelltext
1:
Shape1.Color := MyTable.FieldByName('Farbe').AsInteger;					


Gruß
Klabautermann

PS: Weitere Infos zum auslesen von Werten aus der DB findest du hier.