Por favor, queridos, preciso de ajuda urgente!
07/03/2003
0
Como faço pra conseguir isso? Preciso de ajuda urgente!!!
Desde já obrigada
Mariangela
Anonymous
Posts
07/03/2003
Aroldo Zanela
Use DBCtrlGrid.
07/03/2003
Anonymous
07/03/2003
Anonymous
Quanto a formação de valores currency e float, inclua na published do dbgrid3d.pas
property Moeda : string read fmoeda write Fmoeda;
property Numero: String read fnumero write Fnumero;
e mude os seguintes códigos, somente nas partes em vermelho, para:
constructor TDB3DGrid.Create(AOwner : TComponent);
begin
inherited Create(AOwner);
Color := clBtnFace;
Grid3d:= True;
FBoolAsCheck:= True;
DefaultDrawing:=False;
[color=red:41413e76b7] Fmoeda := ´R$ #,0.00´;
Fnumero:= ´,0.00´;[/color:41413e76b7]end;
procedure TDB3DGrid.DrawCell(ACol, ARow: Longint; ARect: TRect; AState: TGridDrawState);
var
DrawColumn : TColumn;
OldActive : Integer;
Value : string;
ValueStr : String;
begin
if FGrid3D then DefaultDrawing := False;
Canvas.FillRect( ARect );
inherited DrawCell(ACol, ARow,ARect,AState);
if FGrid3D and ([dgRowLines, dgColLines] * Options =
[dgRowLines, dgColLines]) then
begin
if not (gdFixed in AState) then
begin
if (ACol <= Columns.Count) and assigned(Columns[ACol-1].Field) then
begin
DrawColumn := Columns[ACol-1];
*****não mude esta parte eu só alterei para adaptar para o Interbase
[color=blue:41413e76b7] if (Columns[ACol-1].Field.DataType = ftstring) and ((Columns[ACol-1].Field.value = ´T´) or (Columns[ACol-1].Field.value = ´F´))and [/color:41413e76b7]FBoolAsCheck then
begin
OldActive := DataLink.ActiveRecord;
try
DataLink.ActiveRecord := ARow-1;
if Assigned(DrawColumn.Field) then
begin
Value := DrawColumn.Field.value;
DrawCheck(Canvas, ARect, Value );
end;
finally
DataLink.ActiveRecord := OldActive;
end;
end
else begin
OldActive := DataLink.ActiveRecord;
try
DataLink.ActiveRecord := ARow-1;
if Assigned(DrawColumn.Field) then
begin
// if Drawcolumn.Field.DataType = ftstring then
[color=red:41413e76b7] ValueStr := DrawColumn.Field.AsString;
if Drawcolumn.Field.DataType = ftcurrency then
ValueStr := formatfloat(moeda,DrawColumn.Field.Ascurrency);
if Drawcolumn.Field.DataType = ftfloat then
ValueStr := formatfloat(numero,DrawColumn.Field.Ascurrency);[/color:41413e76b7] WriteText(Canvas, ARect, 2, 2, ValueStr, Columns[ACol-1].Alignment);
end;
finally
DataLink.ActiveRecord := OldActive;
end;
end;
end;
end;
with ARect,Canvas do
begin
if (gdFixed in AState) then
Frame3d(Canvas,ARect,clBtnHighLight,clBtnShadow,2)
else begin
Pen.Color := clBtnHighLight;
PolyLine([Point(Left,Bottom-1), Point(Left,Top), Point(Right,Top)]);
Pen.Color := clBtnShadow;
PolyLine([Point(Left,Bottom),Point(Right,Bottom),Point(Right,Top-1)]);
end;
end;
end;
end;
Clique aqui para fazer login e interagir na Comunidade :)