Autor Beitrag
bockwurst
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 191

win98 /XP
D1 D5 Prof DE2005PE
BeitragVerfasst: Fr 25.05.07 10:07 
ich möchte einer bestimmten Zelle im StringGrid eine Farbe geben. Leider finde ich keine Eigenschaft.
Wie kann ich dies machen?

Danke!

Andraes Orban
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Fr 25.05.07 10:32 
Hallo,

aber man findet das Ereignis OnDrawCell in Delphi und auch hier im Forum.
Der Name ansich sagt schon aus welchen Zweck das Ereignis hat.

Also an geeigneter Stelle diese bestimmte Zelle merken und dann im DrawCell-Eventhandler entsprechend darauf reagieren.
Was in Deinem Fall die geeignete Stelle ist vermag ich Aufgrund der fehlenden weiteren Informationen nicht sagen.

Mögliche Stellen wären:
- die Tag-Eigenschaft des Grids
- das Array Cells
- in StringGrid.Objects
- ein seperat geführtes Array
- eine Integer-Variable
...

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
FiceGoesDelphi
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 485

Win XP Prof
Delphi 2006
BeitragVerfasst: Fr 25.05.07 11:14 
Ich habe das so gelöst:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm4.SG_ErgebnisseDrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
  if ACol = ARow then   
    with SG_Ergebnisse do                                                
    begin
      Canvas.Brush.Color := clbtnface;                                 //Die Farbe Grau ausgegeben.
      Canvas.FillRect(Rect);                                           //und zwar komplett gefüllt die Zelle
      Canvas.TextOut(Rect.Left+2, Rect.Top+2, Cells[ACol, ARow]);
   end;

end;

_________________
<(^^<) <(^^)> (>^^)>
===================
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Fr 25.05.07 11:19 
user profile iconFiceGoesDelphi hat folgendes geschrieben:
Ich habe das so gelöst:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm4.SG_ErgebnisseDrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
  if ACol = ARow then   ?????
    with SG_Ergebnisse do                                                
    begin
      Canvas.Brush.Color := clbtnface;                                 //Die Farbe Grau ausgegeben.
      Canvas.FillRect(Rect);                                           //und zwar komplett gefüllt die Zelle
      Canvas.TextOut(Rect.Left+2, Rect.Top+2, Cells[ACol, ARow]);
   end;

end;


????

Wenn Zeile = Spalte dann
????

Wozu braucht man so ne Bedingung?
Klär mich auf Björn, wo du das eingesetzt hast und warum :)

LG
Stefan

PS Ist nicht böse gemeint oder so, es interessiert mich einfach

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
FiceGoesDelphi
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 485

Win XP Prof
Delphi 2006
BeitragVerfasst: Fr 25.05.07 11:23 
Fußballtabelle ;)

---A--B--C--D
A [-] [ ] [ ] [ ]
B [ ] [-] [ ] [ ]
C [ ] [ ] [-] [ ]
D [ ] [ ] [ ] [-]


Da wo Acol = Arow (Also z.B. bei A [-] ist Acol = 1 und Arow = 1 somit Acol = Arow) ist, soll ... usw ;)


Die --- vor dem A,B usw stehen für Leertasten .... anscheinend "Trim"t der hier ;)

_________________
<(^^<) <(^^)> (>^^)>
===================
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Fr 25.05.07 11:29 
user profile iconFiceGoesDelphi hat folgendes geschrieben:
Fußballtabelle ;)

---A--B--C--D
A [-] [ ] [ ] [ ]
B [ ] [-] [ ] [ ]
C [ ] [ ] [-] [ ]
D [ ] [ ] [ ] [-]


Da wo Acol = Arow (Also z.B. bei A [-] ist Acol = 1 und Arow = 1 somit Acol = Arow) ist, soll ... usw ;)


Die --- vor dem A,B usw stehen für Leertasten .... anscheinend "Trim"t der hier ;)


Stimmt..ich denk heut zu kompliziert...

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.