调用ShowDialog更改文化(区域设置)

时间:2013-09-08 14:27:51

标签: c# dialog culture

在调用一个简单的.Net表单(FolderBrowserDialog)时,事实证明在调用ShowDialog()之后文化被更改而没有通知:

string ChooseFolder(ref string sTitle, string sCurDir)
{
    string folderPath = sCurDir;

    FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog();

    //folderBrowserDialog1.RootFolder = Environment.SpecialFolder.MyComputer;
    //folderBrowserDialog1.SelectedPath = sCurDir;
    //folderBrowserDialog1.Description = sTitle;

    string str1 = System.Threading.Thread.CurrentThread.CurrentCulture.Name;
    string str2;

    if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
    {
        str2 = System.Threading.Thread.CurrentThread.CurrentCulture.Name;
        folderPath = folderBrowserDialog1.SelectedPath;
    }

    string str3 = System.Threading.Thread.CurrentThread.CurrentCulture.Name;
    return folderPath;
}

具体来说:str1显示我当前的语言环境(非美国) - str2和str3显示“en-US”语言环境。那是在主线程中,我没有找到任何可能影响它的东西。

很高兴听到您的想法:)

0 个答案:

没有答案