Delphi 控件显示金额(¥0.00)

来源:互联网 发布:网络的各种好处 编辑:程序博客网 时间:2024/06/10 06:59

这个问题让我好纠结,代码里动态绑定数据源动态创建显示,

我想根据空间属性来设置都找不到,更甚之想在代码里找到对应的

代码都找不到几行。

下面我写了函数,只要对数据源和显示空间操作就可以了。


procedure createDBList(cds:TClientDataSet;dxDBTlist: TdxDBGrid);

var
    i:integer;
begin
    for i:=0 to cds.FieldCount-1 do
      begin
        if ((cds.Fields[I].DataType=ftBCD) or (cds.Fields[I].DataType = ftFloat)) then
        begin
          with dxDBTlist.CreateColumn(TdxDBGridCurrencyColumn ) as TdxDBTreeListCurrencyColumn do
            begin
              Fieldname:= cds.Fields[i].FieldName;
              DisplayFormat:='0.00';
            end;
        end
        else
        begin
           with dxDBTlist.CreateColumn(TdxDBTreeListColumn) as TdxDBTreeListColumn do
             begin
               Fieldname:= cds.Fields[i].FieldName;
           end;
        end;
    end;


end;
原创粉丝点击