Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure TFrmPrincipal.PintaAscoisasdoMeuJeito( var Image16x16: TImage; SituacaoLocaliza: string; CorLinha1,
- cCorLinhaSelecionada,cCorApto_Interditado,cCorApto_Sujo: TColor;
- ResultDacondicaoPintarquarto,Verifica_Quarto_Ocupado_Agora: Boolean;
- Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState );
- const cField: string = 'IMG_OCUPACAO';
- function PintaImagemQuartoOcupado( condition: Boolean ): Boolean;
- begin
- If ( condition ) then
- Image16x16.Picture.Bitmap.Canvas.Draw(DBGrid1.Canvas, Rect.Left + (Rect.Width Div 2) - 8, Rect.Top + 1, 0)
- Else
- Image16x16.Picture.Bitmap.Canvas.Draw(DBGrid1.Canvas, Rect.Left + (Rect.Width Div 2) - 8, Rect.Top + 1, 3);
- end;
- function FillStateOrigin: Boolean;
- begin
- result:= not odd(TDBGrid(Sender).DataSource.DataSet.RecNo)
- and not ( gdSelected in State);
- end;
- procedure FilltoLocaliza;
- begin
- if SituacaoLocaliza = 'i' then
- DBGrid1.Canvas.Brush.Color := cCorApto_Interditado
- else
- if SituacaoLocaliza = 'S' then
- DBGrid1.Canvas.Brush.Color := cCorApto_Sujo;
- end;
- begin
- try
- if Column.Field.FieldName = cField then
- begin
- PintaImagemQuartoOcupado( ResultDacondicaoPintarquarto );
- exit;
- end
- else
- if FillStateOrigin then
- DBGrid1.Canvas.Brush.Color := CorLinha1
- else
- begin
- DBGrid1.Canvas.Brush.Color := cCorLinhaSelecionada ;
- end;
- FilltoLocaliza;
- finally
- DBGrid1.Canvas.FillRect(Rect);
- DBGrid1.DefaultDrawDataCell(Rect, Column.Field, State);
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement