procedure TForm1.FormCreate(Sender: TObject);
begin
  { DisplayFormat }
  with TIntegerField.Create(Self) do begin
    FieldName := 'Integer';
    DisplayFormat := '#, 元';
    DataSet := ClientDataSet1;
  end;
  with TDateField.Create(Self) do begin
    FieldName := 'Date';
    DisplayFormat := 'yyyy年m月d日';
    DataSet := ClientDataSet1;
  end;
  with TTimeField.Create(Self) do begin
    FieldName := 'Time';
    DisplayFormat := 'hh时mm分ss秒';
    DataSet := ClientDataSet1;
  end;
  with TFloatField.Create(Self) do begin
    FieldName := 'Float';
    DisplayFormat := '#.00'; { # 是有则用; 0 是不管有无都会占位 }
    DataSet := ClientDataSet1;
  end;

  { Alignment }
  with TFloatField.Create(Self) do begin
    FieldName := 'Alignment';
    Alignment := taCenter;
    DisplayFormat := '#.##';
    DataSet := ClientDataSet1;
  end;
  { currency }
  with TCurrencyField.Create(Self) do begin
    FieldName := 'Currency';
    currency := True;          { 这也是默认的 }
    DataSet := ClientDataSet1;
  end;
  { EditMask }
  with TStringField.Create(Self) do begin
    FieldName := 'EditMask';
    Size := 15;
    EditMask := '!\(999\)000-0000;1;_';
    DataSet := ClientDataSet1;
  end;

  with ClientDataSet1 do begin
    CreateDataSet;
    AppendRecord([1234,'2010-2-9','11:22:3',1.2,1.2,123,'(123)456-7890']);
  end;
end;

posted on 2010-02-09 18:13  万一  阅读(3676)  评论(1编辑  收藏  举报