Ver Mensaje Individual
  #2  
Antiguo 11-10-2011
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola JXJ.

Podrías hacer:
Código Delphi [-]
...
const
   COLSTOCK = 5;  // Columna Stock
...
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
var
  R: TRect;
  v: Double;
begin
  with TStringGrid(Sender) do
  begin
    if TryStrToFloat(Cells[ACol,ARow], v) then  // prevenir posible error de conversión
      if (ACol = COLSTOCK) and (ARow >= FixedRows) then
      begin
        if (v = 0) then    // v = 0 : Sin stock
        begin
          Canvas.Brush.Color:= clRed;
          Canvas.Font.Color:= clWhite;
        end
        else      // hay stock
        begin
          Canvas.Brush.Color:= clLime;
          Canvas.Font.Color:= clBlack;
        end;
        Canvas.FillRect(Rect);
        Canvas.TextOut(Rect.Left+1, Rect.Top+1, Cells[ACol,ARow]);
      end;
  end;
end;

Un saludo.
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....

Última edición por ecfisa fecha: 11-10-2011 a las 20:41:14. Razón: Agregar comentarios
Responder Con Cita