Ver Mensaje Individual
  #3  
Antiguo 08-05-2007
Avatar de droguerman
droguerman droguerman is offline
Miembro
 
Registrado: abr 2005
Ubicación: tierra
Posts: 999
Reputación: 20
droguerman Va por buen camino
código (no probado)
Código Delphi [-]
TForma = class(TForm)
...
private
   lista : TStringList;
...
end;
procedure TForma.TuGridDblClick(Sender: TObject);
var
  indice : integer;
begin
  inherited;
  indice := lista.add(format('%d-%d',[TuGrid.Col, TuGrid.Row]);
  //0 = Azul 1=Rojo
  lista.objects := Pointer(1);
end;

procedure TForma.TuGridClick(Sender: TObject);
var
  indice : integer;
begin
  inherited;
  indice := lista.add(format('%d-%d',[TuGrid.Col, TuGrid.Row]);
  //0 = Azul 1=Rojo
  lista.objects := Pointer(0);
end;

procedure TfmCompra.fraGridxgGridDrawCell(Sender: TObject; ACol,
  ARow: Integer; Rect: TRect; State: TGridDrawState);
var
  texto : string;
  indice : integer;
  colorCelda : TColor;
begin
  inherited;
  texto := IntToStr(ACol)+'-'IntToStr(ARow);
  indice := lista.indexOf(texto);
  if indice>=0 then
  begin
     if Integer(lista.objects[indice])=0 then
         colorCelda := clBlue
    else if Integer(lista.objects[indice])=1 then
         colorCelda := clRed;
  end
  else
     colorCelda :=  TuGrid.color; 

  TuGrid.Canvas.Brush.color := colorCelda;
  TuGrid.Canvas.fillRect(Rect); 
end;

saludos
__________________
self.free;
Responder Con Cita