InputLanguage.LayoutName 属性

定义

在当前键盘布局名称出现在计算机操作系统的区域设置中时获取该名称。

public:
 property System::String ^ LayoutName { System::String ^ get(); };
public string LayoutName { get; }
member this.LayoutName : string
Public ReadOnly Property LayoutName As String

属性值

布局的名称。

示例

下面的代码示例获取与当前输入语言关联的区域性,并显示区域性名称。

首先, CurrentInputLanguage 调用 来获取当前输入语言。 然后, Culture 调用 以获取此输入语言的区域性信息。 最后, EnglishName 检索并在文本框中显示。

public:
   void MyLayoutName()
   {
      // Gets the current input language.
      InputLanguage^ myCurrentLanguage = InputLanguage::CurrentInputLanguage;

      if ( myCurrentLanguage != nullptr )
      {
         textBox1->Text = String::Format( "Layout: {0}", myCurrentLanguage->LayoutName );
      }
      else
      {
         textBox1->Text = "There is no current language";
      }
   }
public void MyLayoutName() {
   // Gets the current input language.
   InputLanguage myCurrentLanguage = InputLanguage.CurrentInputLanguage;

   if(myCurrentLanguage != null) 
      textBox1.Text = "Layout: " + myCurrentLanguage.LayoutName;
   else
      textBox1.Text = "There is no current language";
}
Public Sub MyLayoutName()
   ' Gets the current input language.
   Dim myCurrentLanguage As InputLanguage = InputLanguage.CurrentInputLanguage
       
   If (myCurrentLanguage IsNot Nothing) Then
      textBox1.Text = "Layout: " & myCurrentLanguage.LayoutName
   Else
      textBox1.Text = "There is no current language"
   End If
End Sub

适用于

另请参阅