Ver Mensaje Individual
  #5  
Antiguo 11-12-2008
[egostar] egostar is offline
Registrado
 
Registrado: feb 2006
Posts: 6.556
Reputación: 25
egostar Va camino a la fama
Cita:
Empezado por Caro Ver Mensaje
Lo que pasa amiguito es que el parametro Rect lo tiene en el evento OnDrawCell y el quiere colocar la imagen despues de hacer su consulta osea que no se estaría en el evento OnDrawCell.
Asi es amiguita, no coloque el nombre del evento OnDrawCell porque asumí que estabamos en ese evento, el "pintado" de las imagenes se hace en ese evento, aqui te muestro lo que yo hago.....

Código Delphi [-]
//Consulto es status de una habitación.
function TFcalendar.MaidSt(Habitacion:String):Integer;
begin
  With DataModule1.QMaidStatus do begin
    SQL.Text := 'SELECT STATUS FROM MAIDSTATUS WHERE HABITACION = "'+Habitacion+'"';
    Open;
    Result := fields[0].AsInteger;
    Close;
 end;
end;

//Asigno la imagen que le corresponde a la fila en base al status de la habitación
procedure TFcalendar.StringGrid1DrawCell(Sender: TObject; ACol,
  ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
  with Sender as TStringGrid do begin
    if (ACol=0) then begin
      Case MaidSt(StringGrid1.Cells[0,ARow]) of
         3 : StringGrid1.Canvas.Draw(Rect.Left+34, Rect.Top, Image2.Picture.Graphic);
         4 : StringGrid1.Canvas.Draw(Rect.Left+34, Rect.Top, Image3.Picture.Graphic);
         5 : StringGrid1.Canvas.Draw(Rect.Left+34, Rect.Top, Image1.Picture.Graphic);
      end;
    end;
  end;
end;

Salud ITOS
__________________
"La forma de empezar es dejar de hablar y empezar a hacerlo." - Walt Disney
Responder Con Cita