Advertisement
filhotecmail

Ommar

Aug 1st, 2018
531
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.63 KB | None | 0 0
  1. procedure TFrmPrincipal.PintaAscoisasdoMeuJeito( var Image16x16: TImage; SituacaoLocaliza: string; CorLinha1,
  2.                  cCorLinhaSelecionada,cCorApto_Interditado,cCorApto_Sujo: TColor;
  3.                  ResultDacondicaoPintarquarto,Verifica_Quarto_Ocupado_Agora: Boolean;
  4.                  Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState );
  5.  
  6.   const cField: string = 'IMG_OCUPACAO';
  7.    function PintaImagemQuartoOcupado( condition: Boolean ): Boolean;
  8.    begin
  9.       If ( condition ) then
  10.           Image16x16.Picture.Bitmap.Canvas.Draw(DBGrid1.Canvas, Rect.Left + (Rect.Width Div 2) - 8, Rect.Top + 1, 0)
  11.       Else
  12.           Image16x16.Picture.Bitmap.Canvas.Draw(DBGrid1.Canvas, Rect.Left + (Rect.Width Div 2) - 8, Rect.Top + 1, 3);
  13.    end;
  14.   function FillStateOrigin: Boolean;
  15.   begin
  16.     result:= not odd(TDBGrid(Sender).DataSource.DataSet.RecNo)
  17.              and not ( gdSelected in State);
  18.   end;
  19.   procedure FilltoLocaliza;
  20.   begin
  21.    if  SituacaoLocaliza = 'i' then
  22.          DBGrid1.Canvas.Brush.Color := cCorApto_Interditado
  23.       else
  24.    if  SituacaoLocaliza = 'S' then
  25.         DBGrid1.Canvas.Brush.Color := cCorApto_Sujo;
  26.  
  27.   end;
  28.  
  29. begin
  30.  try
  31.   if  Column.Field.FieldName = cField then
  32.   begin
  33.       PintaImagemQuartoOcupado( ResultDacondicaoPintarquarto );
  34.       exit;
  35.  end
  36.  else
  37.   if FillStateOrigin then
  38.    DBGrid1.Canvas.Brush.Color := CorLinha1
  39.   else
  40.   begin
  41.    DBGrid1.Canvas.Brush.Color := cCorLinhaSelecionada ;
  42.    end;
  43.   FilltoLocaliza;
  44.   finally
  45.    DBGrid1.Canvas.FillRect(Rect);
  46.    DBGrid1.DefaultDrawDataCell(Rect, Column.Field, State);
  47.   end;
  48.  
  49. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement