Colorir célula do StringGrid

Delphi

25/03/2004

Como faço para colorir célula do [color=orange:18dc672c84]StringGrid[/color:18dc672c84]?


Eniosb

Eniosb

Curtidas 0

Respostas

Fabio.hc

Fabio.hc

25/03/2004

Tente assim:

procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;  Rect: TRect; State: TGridDrawState);
const
   LM = 3; {each indiviual cell´s left margin}
   TM = 2; {each indiviual cell´s top margin}
var
   ptr: Pointer;
begin
   {qualquer cor é armazenada no ponteiro do objeto}
   ptr := StringGrid1.Objects[aCol, aRow];
   StringGrid1.Canvas.Font.Color := LongInt(ptr);
   if gdFixed in State then
      StringGrid1.Canvas.Brush.Color := clSilver
   else if gdSelected in State then
      begin
      StringGrid1.Canvas.Brush.Color := clHighlight;
      StringGrid1.Canvas.Font.Color := clHighlightText;
      end
   else
       StringGrid1.Canvas.Brush.Color := clAqua;
   StringGrid1.Canvas.TextRect(Rect, Rect.Left + LM, Rect.Top + TM, StringGrid1.Cells[acol,arow]);
end;



GOSTEI 0
Eniosb

Eniosb

25/03/2004

Valeu Fabio.HC, funcionou direitinho. Muito obrigado. Se precisar é só entrar em contato que tentarei ajudar!


GOSTEI 0
POSTAR