【问题标题】:How fix local language text encoding problems of winform controlswinform控件本地语言文本编码问题如何解决
【发布时间】:2015-11-10 22:31:25
【问题描述】:

在 windowsForm Designer 中,我在表单上放置了一个标签。为其 text 属性写了一些土耳其语字符。 text > "Giriş" 表示登录。

应用程序启动时,ş 字符显示不正确。某种编码问题

Windows10 有 2 个语言包 > 英语(美国)和土耳其语。英语是默认语言和当前使用的语言。我不想以编程方式更改设计元素的文本。我想使用 FormDesigner。

这是我在 Windows 窗体设计器中看到的

这是我在运行时看到的

【问题讨论】:

  • 当您打开设计器时,标签的Text 是否正确显示?
  • 文本在 FormDesigner 中显示良好。不是应用启动时

标签: c# winforms encoding designer vs-community-edition


【解决方案1】:

您必须按照Microsoft's 示例设置CurrentCultureCurrentUICulture

// C#
// Put the using statements at the beginning of the code module
using System.Threading;  
using System.Globalization;

// Put the following code before InitializeComponent()
// Sets the culture to French (France)
Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR");

// Sets the UI culture to French (France)
Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-FR");

您可以在应用程序启动时设置一次。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-10-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-01
    • 2015-03-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多