0
일부 Devexpress 컨트롤이 있습니다.리플렉션을 통해 속성에 액세스하는 방법은 무엇입니까?
리플렉션을 사용하여 일부 속성을 설정하려고합니다.
TextEdit을 가정 해 봅시다.
일반적으로 텍스트 상자의 테두리 색상을 설정, 나는 할 것이다 :
TextEdit1.Properties.Appearance.BorderColor = whatever...
반사를 사용하여 내가 노력하고있어 :
는SetProperty(TextEdit1, "Properties.Appearance.BorderColor", RGB(200, 200, 200))
'Where SetProperty sub is
Private Sub SetProperty(ByVal Control As Object, ByVal PropertyName As String, ByVal Args As Object)
If Not IsNothing(Control.GetType.GetProperty(PropertyName)) Then
CallByName(Control, PropertyName, CallType.Set, Args)
End If
End Sub
이 코드는 결과 때문에 작동하지 않습니다 Control.GetType.GetProperty (PropertyName)은 항상 null입니다.
누구나이 "복합"유형의 속성에 액세스하는 방법을 알고 있습니까? 당신은 이런 식으로 뭔가를해야 할 것
감사
그것은이다, * 기침 *보다 더 복잡 조금. 먼저 Properties 속성에 대해 Get을 수행 한 다음 Appearance 속성에 대해 Get을 수행 한 다음 BorderColor 속성에 대해 Set를 수행해야합니다. 모두 당신을 위해 컴파일러를 사용하고 있습니다. –