判断:
//uses cxTextEdit
cxGrid1DBTableView1Column.PropertiesClass = TcxTextEditProperties;
//uses cxCalendar
cxGrid1DBTableView1Column.PropertiesClass = TcxDateEditProperties;
//uses
cxGrid1DBTableView1Column.PropertiesClass = TcxCalcEditProperties;
//uses cxCheckBox
cxGrid1DBTableView1Column.PropertiesClass = TcxCheckboxProperties;
//uses cxCurrency
cxGrid1DBTableView1Column.PropertiesClass = TcxCurrencyEditProperties;
等效
cxGrid1DBTableView1Column.Properties is TcxTextEditProperties;
cxGrid1DBTableView1Column.Properties is TcxDateEditProperties;
cxGrid1DBTableView1Column.Properties is TcxCalcEditProperties;
cxGrid1DBTableView1Column.Properties is TcxCheckboxProperties;
转换成某类型访问:
cxGrid1DBTableView1Column.Properties as TcxTextEditProperties
cxGrid1DBTableView1Column.Properties as TcxDateEditProperties;
cxGrid1DBTableView1Column.Properties as TcxCalcEditProperties;
赋值:
uses cxLabel, cxEdit;
Columns[I].PropertiesClass := TcxLabelProperties; //必须uses cxLabel,
Columns[I].Properties.Alignment.Horz := taLeftJustify;
Columns[I].Properties.Alignment.Vert := taVCenter; //必须uses cxEdit;
等效
with TcxLabelProperties(Columns[I].PropertiesClass) do //必须uses cxLabel,
begin
Alignment.Horz := taLeftJustify;
Alignment.Vert := taVCenter; //必须uses cxEdit;
end;
TcxCurrencyEditProperties(<aColumn>.Properties).DisplayFormat := '$,0.00;($,0.00)'
1.
推荐判断一下:
if not Assigned(Columns[I].Properties) then
Columns[I].PropertiesClass := TcxTextEditProperties;
注:记录下方便使用