Ver Mensaje Individual
  #2  
Antiguo 03-10-2013
cloayza cloayza is offline
Miembro
 
Registrado: may 2003
Ubicación: San Pedro de la Paz, Chile
Posts: 922
Reputación: 23
cloayza Tiene un aura espectacularcloayza Tiene un aura espectacular
Con su permiso estimado Ecfisa...

Otra opción...

Código Delphi [-]
procedure TForm1.FormCreate(Sender: TObject);
var
  c,f: Integer;
begin
     for c := 0 to StringGrid1.ColCount-1 do
         for f := 0 to StringGrid1.RowCount-1 do
            StringGrid1.Objects[c,f] := Pointer(False);
end;

procedure TForm1.StringGrid1DblClick(Sender: TObject);
begin
     with TStringGrid(Sender) do
     begin
          StringGrid1.Objects[Col, Row] := Pointer(not Boolean(StringGrid1.Objects[Col, Row]));
          Invalidate;
     end;
end;

procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);
const
  COLORS : array[Boolean] of TColor = (clWindow, clGreen);
begin
     with TStringGrid(Sender) do
     begin
       Canvas.Brush.Color := COLORS[Boolean(StringGrid1.Objects[ACol, ARow])];
       Canvas.FillRect(Rect);
       DrawText(Canvas.Handle,PChar(Cells[ACol,ARow]),-1,Rect,DT_SINGLELINE);
     end;
end;

Saludos

Última edición por cloayza fecha: 03-10-2013 a las 22:04:26.
Responder Con Cita