在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;
本文详细介绍了TcxGridDBTableView和TcxGridDBColumn中的三个关键事件:GetStoredProperties、GetStoredPropertyValue及SetStoredPropertyValue。通过示例代码解释了如何使用这些事件来增加属性、设置属性值以及读取属性值。
2796

被折叠的 条评论
为什么被折叠?



