資源簡(jiǎn)介
C# 中英文界面切換系統(tǒng) 一鍵切換

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Text;
using?System.Windows.Forms;
using?System.Threading;
using?System.Globalization;
namespace?ctest
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????private?void?btnChinese_Click(object?sender?EventArgs?e)
????????{
????????????//更改當(dāng)前線程的?CultureInfo
????????????//zh-CN?為中文,更多的關(guān)于?Culture?的字符串請(qǐng)查?MSDN
????????????Thread.CurrentThread.CurrentUICulture?=?CultureInfo.GetCultureInfo(“zh-CN“);
????????????//對(duì)當(dāng)前窗體應(yīng)用更改后的資源
????????????ApplyResource();
????????}
????????private?void?btnEnglish_Click(object?sender?EventArgs?e)
????????{
????????????//更改當(dāng)前線程的?CultureInfo
????????????//en?為英文,更多的關(guān)于?Culture?的字符串請(qǐng)查?MSDN
????????????Thread.CurrentThread.CurrentUICulture?=?CultureInfo.GetCultureInfo(“en“);
????????????//對(duì)當(dāng)前窗體應(yīng)用更改后的資源
????????????ApplyResource();
????????}
????????
????????///?
????????///?應(yīng)用資源
????????///?ApplyResources?的第一個(gè)參數(shù)為要設(shè)置的控件
????????///??????????????????第二個(gè)參數(shù)為在資源文件中的ID,默認(rèn)為控件的名稱
????????///?
????????private?void?ApplyResource()
????????{
????????????System.ComponentModel.ComponentResourceManager?res?=?new?ComponentResourceManager(typeof(Form1));
????????????foreach?(Control?ctl?in?Controls)
????????????{
????????????????res.ApplyResources(ctl?ctl.Name);
????????????}
????????????
????????????//菜單
????????????foreach?(ToolStripMenuItem?item?in?this.menuStrip1.Items)
????????????{
????????????????res.ApplyResources(item?item.Name);
????????????????foreach?(ToolStripMenuItem?subItem?in?item.DropDownItems)
????????????????{
????????????????????res.ApplyResources(subItem?subItem.Name);
????????????????}
????????????}
????????????//Caption
????????????res.ApplyResources(this?“$this“);
????????}
????}
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????1493??2007-07-29?17:10??ctest\bin\Debug\ctest.application
?????文件??????28672??2007-07-29?17:10??ctest\bin\Debug\ctest.exe
?????文件???????2114??2007-07-29?17:10??ctest\bin\Debug\ctest.exe.manifest
?????文件???????4096??2007-07-29?17:10??ctest\bin\Debug\en\ctest.resources.dll
?????文件???????2022??2007-05-24?14:14??ctest\bin\Debug\test.shfb
?????文件???????5244??2007-07-29?17:03??ctest\ctest.csproj
?????文件????????730??2007-05-22?17:38??ctest\ctest.csproj.user
?????文件????????301??2007-05-22?14:33??ctest\ctest.csproj.vspscc
?????文件???????1276??2007-07-29?17:10??ctest\ctest.sln
????..A..H.?????11776??2007-07-29?17:10??ctest\ctest.suo
?????文件????????841??2007-05-28?09:40??ctest\dotfuscator.xm
?????文件???????2050??2007-07-29?17:10??ctest\Form1.cs
?????文件???????5902??2007-07-29?17:06??ctest\Form1.Designer.cs
?????文件???????6762??2007-07-29?17:06??ctest\Form1.en.resx
?????文件??????12086??2007-07-29?17:06??ctest\Form1.resx
?????文件????????497??2007-06-05?11:28??ctest\Program.cs
?????文件???????1258??2007-03-02?11:21??ctest\Properties\AssemblyInfo.cs
?????文件???????2835??2007-05-24?16:33??ctest\Properties\Resources.Designer.cs
?????文件???????5957??2007-04-09?09:24??ctest\Properties\Resources.resx
?????文件???????1084??2007-05-24?16:33??ctest\Properties\Settings.Designer.cs
?????文件????????249??2007-03-02?11:21??ctest\Properties\Settings.settings
????..A.SHR???????283??2007-05-24?17:55??ctest\Properties\vssver2.scc
?????目錄??????????0??2007-07-29?17:02??ctest\bin\Debug\en
?????目錄??????????0??2007-07-29?17:03??ctest\bin\Debug
?????目錄??????????0??2007-07-29?17:02??ctest\bin
?????目錄??????????0??2007-07-29?17:02??ctest\Properties
?????目錄??????????0??2007-07-29?17:10??ctest
?????文件??????19230??2012-08-18?10:15??修改簽名錯(cuò)誤.jpg
-----------?---------??----------?-----??----
???????????????116758????????????????????28
............此處省略1個(gè)文件信息
評(píng)論
共有 條評(píng)論