Autor Beitrag
maniac_89
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 54



BeitragVerfasst: Sa 19.03.05 14:58 
Hallo,
ich wollte Fragen ob es möglich ist bei einem Stringgrid die Zellenfarbe zu ändern, und ich wollte noch Fragen ob es möglich ist in einem Stringgrid mehrere Schriftfarben zu verwenden, denn jedes mal wenn ich beim Start des Programmes die Farbe über eine ColorBox ändere, ändert sich die auch die Textfarbe aller anderen Zellen.
Zum Beispiel: Ich möchte die erste Schwarz haben und die zweite Gelb dann wird die erste auch Gelb, und das soll nicht so sein.

Steffen, Maniac_89


Moderiert von user profile iconTino: Topic aus Sonstiges verschoben am Sa 19.03.2005 um 15:43
wulfskin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1349
Erhaltene Danke: 1

Win XP
D5 Pers (SSL), D2005 Pro, C, C#
BeitragVerfasst: Sa 19.03.05 15:02 
Ja,

geht beides. Schau dir mal das Ereignis OnDrawCell an!

Gruß Hape!

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.
maniac_89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 54



BeitragVerfasst: Sa 19.03.05 15:10 
Und wie soll das funktionieren, wenn ich auf die Auswahl klicke erscheint nichts.
wulfskin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1349
Erhaltene Danke: 1

Win XP
D5 Pers (SSL), D2005 Pro, C, C#
BeitragVerfasst: Sa 19.03.05 16:08 
So zum Beispiel:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
var
  S: String;
begin
  with TStringGrid(Sender) do begin
    Canvas.Brush.Color := clGreen;
    Canvas.FillRect(Rect);
    Canvas.Font.Name := 'Arial';
    Canvas.Font.Color := clRed;
    S := Cells[ACol, ARow];
    DrawText(Canvas.Handle, PChar(S), Length(S), Rect,
      DT_VCENTER or DT_SINGLELINE);
  end;
Gruß Hape!

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.
maniac_89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 54



BeitragVerfasst: Sa 19.03.05 21:07 
Funktioniert bei nicht.
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Sa 19.03.05 21:10 
Das muss natürlich in den OnDrawCell-Eventhandler (heißt der so :gruebel:, hab grad kein Delphi zum Testen da...)

AXMD
maniac_89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 54



BeitragVerfasst: Sa 19.03.05 21:42 
Hat Funktioniert :D .

Danke, hast mir echt geholfen :D

Steffen, Maniac_89