zoukankan      html  css  js  c++  java
  • 设置dbgrideh可显示的列

    {*******************************************************}
    {                                                       }
    {       格式显示                                        }
    {                                                       }
    {       版权所有 (C) 2007 咏南工作室(陈新光)          }
    {                                                       }
    {*******************************************************}

    unit uFormatDisplay;

    interface

    uses
      DB,DBGridEh,SysUtils,Classes;

    { 设置数字或金额字段的显示格式 }
    procedure SetDisplayFormat(ADataset:TDataSet);
    { 设置财务栏 }
    procedure SetMoneyCol(AGrid:TDBGridEh;AFieldName:string);

    implementation

    procedure SetMoneyCol(AGrid:TDBGridEh;AFieldName:string);
    var
      i:Integer;
    begin
      AGrid.CHNCurrencyStyle.ZeroEmpty:=false;
      for i:=0 to AGrid.Columns.Count-1 do
      begin
        with AGrid do
        begin
          if Columns[i].FieldName=AFieldName then
          begin
            Columns[i].DisplayCHNCurrency:=True;
            Columns[i].DisplayZero:=True;
          end;
        end;
      end;
    end;       

    procedure SetDisplayFormat(ADataset:TDataSet);
    var
      i:Integer;
    begin
      for i:=0 to ADataset.FieldCount-1 do
      begin
        with ADataset do
        begin
          if Fields[i] is TBCDField then
            (Fields[i] as TBCDField).DisplayFormat := '###,##0.00';
        end;
      end;
    end;

    end.
     

  • 相关阅读:
    luogu_P1850 换教室
    luogu_P3224 [HNOI2012]永无乡
    luogu_P1064 金明的预算方案
    luogu_P2014 选课
    luogu_P3372 【模板】线段树 1(动态开点)
    luogu_P2852 [USACO06DEC]牛奶模式Milk Patterns
    luogu_P1941 飞扬的小鸟
    luogu_P2678 跳石头
    luogu_P1638 逛画展
    【Tyvj2046】掷骰子
  • 原文地址:https://www.cnblogs.com/hnxxcxg/p/2940898.html
Copyright © 2011-2022 走看看