Fórum Linhas coloridas numa Grid #217906
03/03/2004
0
Neste tem um campo de DIAS.
Há como colocar a linha da Grid dependendo do valor do campo DIAS
Uso delphi 7
Obrigado
Jonnymarques
Curtir tópico
+ 0Posts
03/03/2004
Fabio.hc
Ex:
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); begin if (Column.Field.FieldName = ´DIAS´) then begin if Column.Field.Value = 3 then begin DBGrid1.Canvas.Brush.Color:= clAqua; DBGrid1.Canvas.Font.Color:= clWindowText; DBGrid1.Canvas.FillRect(Rect); DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State); end; end; end;
Gostei + 0
03/03/2004
Jonnymarques
Mas tentei fazer a linha ficar toda colorida e não consegui.
Tem alguma idéia.
Obrigado
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); begin if (Column.Field.FieldName = ´DIAS´) then begin if Column.Field.Value = 3 then begin DBGrid1.Canvas.Brush.Color:= clAqua; DBGrid1.Canvas.Font.Color:= clWindowText; DBGrid1.Canvas.FillRect(Rect); DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State); end; end; end;
Gostei + 0
03/03/2004
Fabio.hc
Ex: [b:37cf5360de]DrawDataCell[/b:37cf5360de]
procedure TForm1.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect; Field: TField; State: TGridDrawState); begin if Query1DIAS.Value = 3 then begin DBGrid1.Canvas.Brush.Color:= clAqua; DBGrid1.Canvas.Font.Color:= clWindowText; DBGrid1.Canvas.FillRect(Rect); DBGrid1.Canvas.TextOut(Rect.Left+2, Rect.Top+2, Field.Text); end; end;
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)