Pintado de líneas en un StringGrid
Artículo por Club Developers · 31 diciembre 2005
3471 vistas
Este código permite obtener una rejilla con las lÃenas de colores diferentes. Esto facilita la lectura de rejillas con tamaños grandes.
delphi
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); begin with Sender as TStringGrid do with Canvas do begin { selección del color de fondo } if gdFixed in State then Brush.Color := clBtnFace else if gdSelected in State then Brush.Color := clNavy else if Odd(ARow) then Brush.Color := $FFE0FF else Brush.Color := $FFFFE0; { pintado del fondo } FillRect(Rect); { selección del color de escritura } if gdSelected in State then Font.Color:=clWhite else Font.Color := clBlack; { dibujado del texto } TextOut(Rect.Left, Rect.Top, Cells[ACol, ARow]); End; end;


