Fórum Alterando valor de uma célula no DbGrid #265639
17/01/2005
0
Preciso alterar o valor de uma célula no DbGrid.
Por exemplo, quando o valor da célula for ´C´, preciso alterar para ´CLIENTE´.
Muito Obrigado.
Christian.selbmann
Curtir tópico
+ 0Posts
17/01/2005
Massuda
Gostei + 0
17/01/2005
Christian.selbmann
Procurei pelo site, e não encontrei nenhum exemplo relacionado a alterar os valores do grid. Só encontrei como alterar a cor da célula.
É muito diferente do método pra alterar a cor ?
Obrigado.
Gostei + 0
17/01/2005
Massuda
procedure TFrm1.DBGridDrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); var S: string; begin if Column.FieldName = ´NomeDoCampo´ then begin with DBGrid.Canvas do begin FillRect(Rect); S := Column.Field.AsString; if S = ´C´ then S := ´Cliente´; // ... R := Rect; DrawText(Handle, PChar(S), Length(S), R, DT_CENTER or DT_VCENTER); end; end else begin DefaultDrawColumnCell(Rect, DataCol, Column, State); end; end;
Gostei + 0
18/02/2005
Amjorge
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)