您的位置:首页 > 其它

在cxgrid StoreToIniFile、RestoreFromIniFile 中 加入自定义属性

2016-07-16 21:38 766 查看
在TcxGridDBTableView和TcxGridDBColumn中有三个事件:

GetStoredProperties

GetStoredPropertyValue

SetStoredPropertyValue

procedure TFrm_Company.cxgrdbclmn_02GetStoredProperties(
Sender: TcxCustomGridTableItem; AProperties: TStrings);
begin
inherited;//增加一个属性
AProperties.Add('HeaderAlignmentHorz');
end;

procedure TFrm_Company.cxgrdbclmn_02GetStoredPropertyValue(
Sender: TcxCustomGridTableItem; const AName: string; var AValue: Variant);
begin
inherited;//给新增加的属性赋值,这里是一个枚举类型
if (AName = 'HeaderAlignmentHorz') then
AValue := GetEnumName(TypeInfo(TAlignment),Ord(TcxCustomGridColumn(Sender).HeaderAlignmentHorz));
end;

procedure TFrm_Company.cxgrdbclmn_02SetStoredPropertyValue(
Sender: TcxCustomGridTableItem; const AName: string; const AValue: Variant);
begin
inherited;//读取属性值
if (AName = 'HeaderAlignmentHorz') then
TcxCustomGridColumn(Sender).HeaderAlignmentHorz :=
TAlignment(GetEnumValue(TypeInfo(TAlignment), AValue));
end;


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: