2011年8月30日 星期二

資源檔來做多國語言的介面

參考1
參考2
---
引用參考1範例:

Imports System.Globalization
Imports System.Reflection

Public Class Form1

Dim RM As Resources.ResourceManager
Dim CI As CultureInfo

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
RM = New Resources.ResourceManager("ResourceTest.Resource", Assembly.GetExecutingAssembly)
End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Select Case ComboBox1.SelectedIndex
Case Is = 0
CI = New CultureInfo("en-US")
Case Is = 1
CI = New CultureInfo("zh-CN")
Case Is = 2
CI = New CultureInfo("zh-TW")
Case Else
Exit Sub
End Select
Threading.Thread.CurrentThread.CurrentUICulture = CI
Label1.Text = RM.GetString("button")
Label2.Text = RM.GetString("text")
End Sub
End Class

---
我自己的範例圖:


沒有留言:

張貼留言