3
간단한 샘플을 확인하십시오 (실제 시나리오가 다릅니다). 개체의 중첩 된 속성 값을 설정하고 싶습니다.이 경우에는 TLabel
구성 요소의 글꼴은 RTTI를 사용하여 clRed
입니다. RTTI를 사용하여 중첩 된 속성의 값을 설정할 수있는 방법
var
p : TRttiProperty;
p2: TRttiProperty;
c : TRttiContext;
begin
c := TRttiContext.Create;
try
p := c.GetType(Label1.ClassInfo).GetProperty('Font');
p2 := c.GetType(p.PropertyType.Handle).GetProperty('Color');
p2.SetValue(p.PropertyType.AsInstance,clred); //this line is not working
finally
c.Free;
end;
end;
은 내가
p2.SetValue(Label1,clred);
대단히 감사합니다. Robert. – Salvador