X
xfg66701971
Unregistered / Unconfirmed
GUEST, unregistred user!
请问各位高手,这个涵数在克隆DBChart控件时为什么会少了些属性,事件(如Color,OnClick),其它控件我调试过了是可以的。
function CloneProperty2(SourceComp, TargetComp: TObject): Boolean;
var
i: Integer;
Properties : PPropList;
begin
Result := True;
try
for i := 0 to GetPropList(SourceComp, Properties) -1 do
begin
if LowerCase(Properties.Name) = 'name' then continue;
if LowerCase(Properties.Name) = 'top' then continue;
if not IsPublishedProp(SourceComp, Properties.Name) then Continue;
if not IsPublishedProp(TargetComp, Properties.Name) then Continue;
if PropType(SourceComp, Properties.Name) <> PropType(TargetComp, Properties.Name) then
Continue;
case PropType(SourceComp, Properties.Name) of
tkClass:
SetObjectProp(TargetComp, Properties,GetObjectProp(SourceComp, Properties));
tkMethod:
SetMethodProp(TargetComp, Properties, GetMethodProp(SourceComp,Properties));
else
SetPropValue(TargetComp, Properties.Name, GetPropValue(SourceComp,
Properties.Name));
end;
end;
except
Result := False;
end;
end;
function CloneProperty2(SourceComp, TargetComp: TObject): Boolean;
var
i: Integer;
Properties : PPropList;
begin
Result := True;
try
for i := 0 to GetPropList(SourceComp, Properties) -1 do
begin
if LowerCase(Properties.Name) = 'name' then continue;
if LowerCase(Properties.Name) = 'top' then continue;
if not IsPublishedProp(SourceComp, Properties.Name) then Continue;
if not IsPublishedProp(TargetComp, Properties.Name) then Continue;
if PropType(SourceComp, Properties.Name) <> PropType(TargetComp, Properties.Name) then
Continue;
case PropType(SourceComp, Properties.Name) of
tkClass:
SetObjectProp(TargetComp, Properties,GetObjectProp(SourceComp, Properties));
tkMethod:
SetMethodProp(TargetComp, Properties, GetMethodProp(SourceComp,Properties));
else
SetPropValue(TargetComp, Properties.Name, GetPropValue(SourceComp,
Properties.Name));
end;
end;
except
Result := False;
end;
end;