0

在调用一个简单的 .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”语言环境。那是在主线程中,我没有发现任何其他可能影响它的东西。

很高兴听到你的想法:)

4

0 回答 0