Autor Beitrag
oreca
Hält's aus hier
Beiträge: 4



BeitragVerfasst: Do 17.04.08 17:09 
Hi

also ich will eine zelle eines stringrids einfärben und/oder den text darin...
nur hab ich ka wie ich diese zelle ansprechen soll da sowas wie
cells[0,0].backroundcolor:=....
oder
cells[0,0].canvas.font:=....

nicht funktioniert
ist wahrscheinlich total der kinderkram aber trozdem danke fürs helfen
zongo-joe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 134

win xp prof
D3, D4, D7
BeitragVerfasst: Do 17.04.08 17:27 
Die Frage kam schon ein paarmal.
Versuch mal Suche in: Delphi-Forum STRINGGRID FÄRBEN , da kommen eininge Lösungen.
oreca Threadstarter
Hält's aus hier
Beiträge: 4



BeitragVerfasst: Do 17.04.08 17:31 
da hab ich nix nützliche gefunden
sry
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Do 17.04.08 17:40 
user profile iconoreca hat folgendes geschrieben:
da hab ich nix nützliche gefunden
sry

Hallo,

da guggst du halt nach Suche in: Delphi-Forum, Delphi-Library STRINGGRID ONDRAWCELL

Gruß Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
zongo-joe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 134

win xp prof
D3, D4, D7
BeitragVerfasst: Do 17.04.08 17:42 
Du kannst aber flott lesen... :roll:
In www.delphi-forum.de/...=stringgrid+f%E4rben
von GRENZGAENGER:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TfMain.sgDrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
begin
 if not Odd(ARow) and not (gdFixed in State) then
  with sg do
  begin
   Canvas.Brush.Color := clWebMintcream; 
   Canvas.FillRect(Rect);
   Canvas.TextOut(Rect.Left+2, Rect.Top+2, Cells[ACol, ARow]);
  end;
end;


In www.delphi-forum.de/...=stringgrid+f%E4rben
von JACOSUL:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
procedure TfrmMain.grdKalenderDrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);
var
  RectLinks : TRect;
  RectRechts : TRect;
begin
  if (ACol > 0) and (ARow > 0) then begin
    //Initialisierung
    Rect.Bottom := Rect.Bottom-1;
    Rect.Right := Rect.Right-1;
    Rect.Top := Rect.Top+1;
    Rect.Left := Rect.Left+1;
    RectLinks.Top := Rect.Top;
    RectLinks.Right := Rect.Left + (Rect.Right - Rect.Left) div 2;
    RectLinks.Left := Rect.Left;
    RectLinks.Bottom := Rect.Bottom;
    RectRechts.Top := Rect.Top;
    RectRechts.Right := Rect.Right;
    RectRechts.Left := Rect.Left + (Rect.Right - Rect.Left) div 2;
    RectRechts.Bottom := Rect.Bottom;

    grdKalender.Canvas.Brush.Color := Liste[ARow,ACol].Links;
    grdKalender.Canvas.FillRect(RectLinks);
    grdKalender.Canvas.TextRect(RectLinks, RectLinks.Left + 1, RectLinks.Top + 1, copy(Liste[ARow,ACol].Text,1,1));

    grdKalender.Canvas.Brush.Color := Liste[ARow,ACol].Rechts;
    grdKalender.Canvas.FillRect(RectRechts);
    grdKalender.Canvas.TextRect(RectRechts, RectRechts.Left + 1, RectRechts.Top + 1, copy(Liste[ARow,ACol].Text,2,1));

    if (grdKalender.Selection.Left <= ACol) and (grdKalender.Selection.Right >= ACol) and
       (grdKalender.Selection.Top <= ARow) and (grdKalender.Selection.Bottom >= ARow) then begin
      grdKalender.Canvas.Brush.Color := TColor(Integer(grdKalender.Canvas.Brush.Color) xor $00FFFFFF);
      grdKalender.Canvas.FrameRect(Rect);
    end;
  end;
end;