16,549
社区成员
发帖
与我相关
我的任务
分享
Modules:
Public Sub ApplyResource(ByVal MyForm As Form)
Dim res As System.ComponentModel.ComponentResourceManager = New ComponentResourceManager(MyForm.GetType)
With MyForm
For i = 0 To .Controls.Count - 1
res.ApplyResources(.Controls(i), .Controls(i).Name)
autoControlMultiLanguage(.Controls(i), MyForm)
Next i
End With
res.ApplyResources(MyForm, "$this")
End Sub
Private Sub autoControlMultiLanguage(ByVal iControl As Control, ByVal myForm As Form)
Dim i As Integer
Dim res As System.ComponentModel.ComponentResourceManager = New ComponentResourceManager(MyForm.GetType)
For i = 0 To iControl.Controls.Count - 1
res.ApplyResources(iControl.Controls(i), iControl.Controls(i).Name)
autoControlMultiLanguage(iControl.Controls(i), myForm)
Next
End Sub
Form:
Select Case cmblanguage.SelectedIndex
Case 0
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("en-US")
Case 1
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("zh-CN")
End Select
ApplyResource(Me)