Share via


Thread.CurrentCulture プロパティ

現在のスレッドのカルチャを取得または設定します。

Public Property CurrentCulture As CultureInfo
[C#]
public CultureInfo CurrentCulture {get; set;}
[C++]
public: __property CultureInfo* get_CurrentCulture();public: __property void set_CurrentCulture(CultureInfo*);
[JScript]
public function get CurrentCulture() : CultureInfo;public function set CurrentCulture(CultureInfo);

プロパティ値

現在のスレッドのカルチャを表す CultureInfo

使用例

[Visual Basic, C#, C++] コントロール パネルで設定したカルチャで Windows フォームのユーザー インターフェイスを表示するためのスレッド ステートメントの例を次に示します。このコードには、追加のコードが必要です。

 
' Compile with option t:winexe /r:System.dll,System.Windows.Forms.dll.

Option Explicit
Option Strict

Imports System
Imports System.Threading
Imports System.Windows.Forms

Public Class UICulture
    Inherits Form

    Sub New()

        ' Set the user interface to display in the
        ' same culture as that set in Control Panel.
        Thread.CurrentThread.CurrentUICulture = _
            Thread.CurrentThread.CurrentCulture

        ' Add additional code.
    End Sub

    <STAThreadAttribute> Shared Sub Main()
        Application.Run(New UICulture())
    End Sub

End Class

[C#] 
// Compile with option /t:winexe.

using System;
using System.Threading;
using System.Windows.Forms;

class UICulture : Form
{
    public UICulture()
    {
        // Set the user interface to display in the
        // same culture as that set in Control Panel.
        Thread.CurrentThread.CurrentUICulture = 
            Thread.CurrentThread.CurrentCulture;

        // Add additional code.
    }

    [STAThreadAttribute]
    static void Main()
    {
        Application.Run(new UICulture());
    }
}

[C++] 
#using <mscorlib.dll>
#using <system.dll>
#using <system.windows.forms.dll>

using namespace System;
using namespace System::Threading;
using namespace System::Windows::Forms;

__gc class UICulture : public Form
{
public:
    UICulture()
    {
        // Set the user interface to display in the
        // same culture as that set in Control Panel.
        Thread::CurrentThread->CurrentUICulture = 
            Thread::CurrentThread->CurrentCulture;

        // Add additional code.
    }
};

[STAThreadAttribute]
void WinMain()
{
    Application::Run(new UICulture());
}

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

.NET Framework セキュリティ:

参照

Thread クラス | Thread メンバ | System.Threading 名前空間