Control.AccessibleName 属性

获取或设置辅助功能客户端应用程序所使用的控件名称。

**命名空间:**System.Windows.Forms
**程序集:**System.Windows.Forms(在 system.windows.forms.dll 中)

语法

声明
<LocalizableAttribute(True)> _
Public Property AccessibleName As String
用法
Dim instance As Control
Dim value As String

value = instance.AccessibleName

instance.AccessibleName = value
[LocalizableAttribute(true)] 
public string AccessibleName { get; set; }
[LocalizableAttribute(true)] 
public:
property String^ AccessibleName {
    String^ get ();
    void set (String^ value);
}
/** @property */
public String get_AccessibleName ()

/** @property */
public void set_AccessibleName (String value)
public function get AccessibleName () : String

public function set AccessibleName (value : String)

属性值

辅助功能客户端应用程序所使用的控件名称。默认为 空引用(在 Visual Basic 中为 Nothing)。

备注

AccessibleName 属性是一个标签,它简要描述和标识其容器内的对象,比如 Button 中的文本、MenuItem 的名称,或者 TextBox 控件旁边显示的标签。

有关辅助性对象的属性的更多信息,请参见位于 https://www.microsoft.com/china/msdn/library. 上的 MSDN Library 中的“Content of Descriptive Properties”(描述性属性的内容)主题。

示例

下面的代码示例创建 CheckBox 派生类的一个实例 MyCheckBox,将一个 Image 分配给它的 Image 属性,并设置 AccessibleNameAccessibleDescription 属性,因为 Text 属性为 空引用(在 Visual Basic 中为 Nothing)。该示例要求有一个名为 MyFormForm

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
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:
   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.set_Location(new Point(5, 5));
    myCheckBox.set_Image(Image.FromFile(Application.get_CommonAppDataPath() 
        + "\\Preview.jpg"));
    // Set the AccessibleName property
    // since there is no Text displayed.
    myCheckBox.set_AccessibleName("Preview");
    myCheckBox.set_AccessibleDescription(
        "A toggle button used to show the document preview.");
    this.get_Controls().Add(myCheckBox);
} //MyForm

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

请参见

参考

Control 类
Control 成员
System.Windows.Forms 命名空间
Control.AccessibleDescription 属性
AccessibleRole
Control.AccessibleDefaultActionDescription 属性
AccessibleObject.Name 属性