재귀 적 방법을 사용하여 양식의 모든 구성 요소를 다시 칠하려고합니다. 그러나, 그것은 항상 양식을 recolors 다음 중지됩니다. 어떻게하면이 단계를 지나갈 수 있습니까? 다음은 내가 실험 해본 코드입니다 :VB에서 재귀 회귀
Public Sub fixUIIn(ByRef comp As System.ComponentModel.Component, ByVal style As SByte)
Debug.WriteLine(comp)
If TypeOf comp Is System.Windows.Forms.ContainerControl Then
Dim c As System.Windows.Forms.ContainerControl
c = comp
c.BackColor = getColor(style, PART_BACK)
c.ForeColor = getColor(style, PART_TEXT)
If ((comp.Container IsNot Nothing) AndAlso (comp.Container.Components IsNot Nothing)) Then
For i As Integer = 0 To comp.Container.Components.Count() Step 1
fixUIIn(comp.Container.Components.Item(i), style)
Next
End If
comp = c
End If
If TypeOf comp Is System.Windows.Forms.ButtonBase Then
Dim c As System.Windows.Forms.ButtonBase
c = comp
c.FlatStyle = Windows.Forms.FlatStyle.Flat
c.BackColor = getColor(style, PART_BOX)
c.ForeColor = getColor(style, PART_TEXT)
comp = c
End If
If ((comp.Container IsNot Nothing) AndAlso (comp.Container.Components IsNot Nothing)) Then
For i As Integer = 0 To comp.Container.Components.Count() Step 1
fixUIIn(comp.Container.Components.Item(i), style)
Next
End If
End Sub
comp = 현재 양식을 사용하고 계십니까? 대신 폼의 컨트롤에서 실행 해보십시오. – Toby
예, 그렇습니다. – Supuhstar