Control.AccessibleName 屬性

定義

取得或設定協助工具用戶端應用程式使用的控制項名稱。

C#
public string AccessibleName { get; set; }
C#
public string? AccessibleName { get; set; }

屬性值

協助工具用戶端應用程式使用的控制項名稱。 預設值為 null

範例

下列程式碼範例會建立衍生類別的 CheckBox 實例, MyCheckBox 並將 它 Image 指派給其 Image 屬性,並設定 AccessibleNameAccessibleDescription 屬性,因為 Text 屬性為 null 。 此範例需要您有名為 FormMyForm 的 。

C#
public MyForm()
{
   // Create a 'MyCheckBox' control and 
   // display an image on it.
   MyCustomControls.MyCheckBox myCheckBox = 
      new MyCustomControls.MyCheckBox();
   myCheckBox.Location = new Point(5,5);
   myCheckBox.Image = Image.FromFile(
     Application.CommonAppDataPath + "\\Preview.jpg");

   // Set the AccessibleName property
   // since there is no Text displayed.
   myCheckBox.AccessibleName = "Preview";
   myCheckBox.AccessibleDescription =
     "A toggle button used to show the document preview.";
   this.Controls.Add(myCheckBox);
}

備註

屬性 AccessibleName 是一個標籤,會簡短描述並識別其容器內的物件,例如 中的 Button 文字、的名稱 MenuItem 或顯示在控制項旁的 TextBox 標籤。

For more information about properties of accessible objects, see the "Content of Descriptive Properties.

適用於

產品 版本
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

另請參閱