共用方式為


Control.AccessibleName 屬性

定義

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

public:
 property System::String ^ AccessibleName { System::String ^ get(); void set(System::String ^ value); };
public string AccessibleName { get; set; }
public string? AccessibleName { get; set; }
member this.AccessibleName : string with get, set
Public Property AccessibleName As String

屬性值

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

範例

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

public:
   MyForm()
   {
      // Create a 'MyCheckBox' control and
      // display an image on it.
      MyCustomControls::MyCheckBox^ myCheckBox = gcnew MyCustomControls::MyCheckBox;
      myCheckBox->Location = Point(5,5);
      myCheckBox->Image = Image::FromFile( String::Concat( 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 );
   }
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);
}
Public Sub New()
   ' Create a 'MyCheckBox' control and 
   ' display an image on it. 
   Dim myCheckBox As 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"

   ' Set the AccessibleDescription text.
   myCheckBox.AccessibleDescription = _
     "A toggle button used to show the document preview."
   Me.Controls.Add(myCheckBox)
End Sub

備註

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

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

適用於

另請參閱