Control.ControlAccessibleObject クラス
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)


Windows フォームにはユーザー補助サポートが組み込まれており、アプリケーションをユーザー補助クライアント アプリケーションと協調して動作させるための、アプリケーションに関する情報が提供されます。ユーザー補助クライアント アプリケーションの例には、画面拡大ユーティリティおよびレビューア ユーティリティ、音声入力ユーティリティ、オンスクリーン キーボード、代替入力デバイス、およびキーボード拡張ユーティリティがあります。こうしたユーザー補助クライアント アプリケーションに対して、追加情報を提供する必要が生じる場合があります。この追加情報を提供するには 2 つの方法があります。既存のコントロールの制限付きユーザー補助情報を提供するには、コントロールの AccessibleName、AccessibleDescription、AccessibleDefaultActionDescription、AccessibleRole の各プロパティ値を設定します。これらの値はユーザー補助クライアント アプリケーションに報告されます。また、コントロールにさらに多くのユーザー補助情報を含める必要がある場合は、AccessibleObject クラスまたは Control.ControlAccessibleObject クラスから派生させてユーザー独自のクラスを書き込むことができます。たとえば、共通のコントロールから派生していない独自のコントロールを書き込んでいる場合、または自分のコントロールの中でヒット テストなどの操作が必要な場合は、CreateAccessibilityInstance メソッドを呼び出して、コントロールの Control.ControlAccessibleObject を作成する必要があります。
![]() |
---|
AccessibleObject.GetChild メソッドをオーバーライドする場合は、AccessibleObject.GetChildCount メソッドもオーバーライドする必要があります。AccessibilityObject プロパティを取得または設定するには、.NET Framework と一緒にインストールされている Accessibility アセンブリへの参照を追加する必要があります。 |
アクセス可能なオブジェクトの詳細については、MSDN ライブラリの「Active Accessibility」を参照してください。

CheckBox クラスから派生したチェック ボックス コントロールを作成し、この派生したクラスで使用するカスタムの Control.ControlAccessibleObject を作成するコード例を次に示します。派生クラス MyCheckBox は Button の Appearance を既定で持っているため、これはトグル ボタンとして表示されます。派生 Control.ControlAccessibleObject クラス MyCheckBoxControlAccessibleObject は、3 つのプロパティをオーバーライドして、表示の違いを考慮します。
Imports System Imports System.Windows.Forms Imports Accessibility Imports System.Drawing Namespace MyCustomControls Public Class MyCheckBox Inherits CheckBox Public Sub New() ' Make the check box appear like a toggle button. Me.Appearance = Appearance.Button ' Center the text on the button. Me.TextAlign = ContentAlignment.MiddleCenter End Sub ' Create an instance of the AccessibleObject ' defined for the 'MyCheckBox' control Protected Overrides Function CreateAccessibilityInstance() _ As AccessibleObject Return New MyCheckBoxAccessibleObject(Me) End Function End Class ' Accessible object for use with the 'MyCheckBox' control. Friend Class MyCheckBoxAccessibleObject Inherits Control.ControlAccessibleObject Public Sub New(owner As MyCheckBox) MyBase.New(owner) End Sub Public Overrides ReadOnly Property DefaultAction() As String Get ' Return the DefaultAction based upon ' the state of the control. If CType(Owner, MyCheckBox).Checked Then Return "Toggle button up" Else Return "Toggle button down" End If End Get End Property Public Overrides Property Name() As String Get ' Return the Text property of the control ' if the AccessibleName is null. Dim accessibleName As String = Owner.AccessibleName If Not (accessibleName Is Nothing) Then Return accessibleName End If Return CType(Owner, MyCheckBox).Text End Get Set MyBase.Name = value End Set End Property Public Overrides ReadOnly Property Role() As AccessibleRole Get ' Since the check box appears like a button, ' make the Role the same as a button. Return AccessibleRole.PushButton End Get End Property End Class End Namespace
using System; using System.Windows.Forms; using Accessibility; using System.Drawing; namespace MyCustomControls { public class MyCheckBox : CheckBox { public MyCheckBox() { // Make the check box appear like a toggle button. this.Appearance = Appearance.Button; // Center the text on the button. this.TextAlign = ContentAlignment.MiddleCenter; // Set the AccessibleDescription text. this.AccessibleDescription = "A toggle style button."; } // Create an instance of the AccessibleObject // defined for the 'MyCheckBox' control protected override AccessibleObject CreateAccessibilityInstance() { return new MyCheckBoxAccessibleObject(this); } } // Accessible object for use with the 'MyCheckBox' control. internal class MyCheckBoxAccessibleObject : Control.ControlAccessibleObject { public MyCheckBoxAccessibleObject(MyCheckBox owner) : base(owner) { } public override string DefaultAction { get { // Return the DefaultAction based upon // the state of the control. if( ((MyCheckBox)Owner).Checked ) { return "Toggle button up"; } else { return "Toggle button down"; } } } public override string Name { get { // Return the Text property of the control // if the AccessibleName is null. string name = Owner.AccessibleName; if (name != null) { return name; } return ((MyCheckBox)Owner).Text; } set { base.Name = value; } } public override AccessibleRole Role { get { // Since the check box appears like a button, // make the Role the same as a button. return AccessibleRole.PushButton; } } } }
#using <Accessibility.dll> #using <System.Drawing.dll> #using <System.dll> #using <System.Windows.Forms.dll> using namespace System; using namespace System::Windows::Forms; using namespace System::Drawing; namespace MyCustomControls { public ref class MyCheckBox: public CheckBox { public: MyCheckBox() { // Make the check box appear like a toggle button. this->Appearance = ::Appearance::Button; // Center the text on the button. this->TextAlign = ContentAlignment::MiddleCenter; // Set the AccessibleDescription text. this->AccessibleDescription = "A toggle style button."; } protected: // Create an instance of the AccessibleObject // defined for the 'MyCheckBox' control virtual AccessibleObject^ CreateAccessibilityInstance() override; }; // Accessible Object* for use with the 'MyCheckBox' control. private ref class MyCheckBoxAccessibleObject: public Control::ControlAccessibleObject { public: MyCheckBoxAccessibleObject( MyCheckBox^ owner ) : ControlAccessibleObject( owner ) {} property String^ DefaultAction { virtual String^ get() override { // Return the DefaultAction based upon // the state of the control. if ( (dynamic_cast<MyCheckBox^>(Owner))->Checked ) { return "Toggle button up"; } else { return "Toggle button down"; } } } property String^ Name { virtual String^ get() override { // Return the Text property of the control // if the AccessibleName is 0. String^ name = Owner->AccessibleName; if ( name != nullptr ) { return name; } return (dynamic_cast<MyCheckBox^>(Owner))->Text; } virtual void set( String^ value ) override { ControlAccessibleObject::Name = value; } } property AccessibleRole Role { virtual AccessibleRole get() override { // Since the check box appears like a button, // make the Role the same as a button. return AccessibleRole::PushButton; } } }; AccessibleObject^ MyCheckBox::CreateAccessibilityInstance() { return gcnew MyCheckBoxAccessibleObject( this ); } }
package MyCustomControls; import System.*; import System.Windows.Forms.*; import Accessibility.*; import System.Drawing.*; public class MyCheckBox extends CheckBox { public MyCheckBox() { // Make the check box appear like a toggle button. this.set_Appearance(get_Appearance().Button); // Center the text on the button. this.set_TextAlign(ContentAlignment.MiddleCenter); // Set the AccessibleDescription text. this.set_AccessibleDescription("A toggle style button."); } //MyCheckBox // Create an instance of the AccessibleObject // defined for the 'MyCheckBox' control protected AccessibleObject CreateAccessibilityInstance() { return new MyCheckBoxAccessibleObject(this); } //CreateAccessibilityInstance } //MyCheckBox // Accessible object for use with the 'MyCheckBox' control. class MyCheckBoxAccessibleObject extends Control.ControlAccessibleObject { public MyCheckBoxAccessibleObject(MyCheckBox owner) { super(owner); } //MyCheckBoxAccessibleObject /** @property */ public String get_DefaultAction() { // Return the DefaultAction based upon // the state of the control. if (((MyCheckBox)get_Owner()).get_Checked()) { return "Toggle button up"; } else { return "Toggle button down"; } } //get_DefaultAction /** @property */ public String get_Name() { // Return the Text property of the control // if the AccessibleName is null. String name = get_Owner().get_AccessibleName(); if (name != null) { return name; } return ((MyCheckBox)get_Owner()).get_Text(); } //get_Name /** @property */ public void set_Name(String value) { super.set_Name(value); } //set_Name /** @property */ public AccessibleRole get_Role() { // Since the check box appears like a button, // make the Role the same as a button. return AccessibleRole.PushButton; } //get_Role } //MyCheckBoxAccessibleObject

System.MarshalByRefObject
System.Runtime.InteropServices.StandardOleMarshalObject
System.Windows.Forms.AccessibleObject
System.Windows.Forms.Control.ControlAccessibleObject
System.Windows.Forms.ButtonBase.ButtonBaseAccessibleObject
System.Windows.Forms.DataGridView.DataGridViewAccessibleObject
System.Windows.Forms.DateTimePicker.DateTimePickerAccessibleObject
System.Windows.Forms.DomainUpDown.DomainUpDownAccessibleObject
System.Windows.Forms.ToolStrip.ToolStripAccessibleObject


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Control.ControlAccessibleObject コンストラクタ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)



CheckBox クラスから派生したチェック ボックス コントロールを作成し、この派生したクラスで使用するカスタムの Control.ControlAccessibleObject を作成するコード例を次に示します。派生クラス MyCheckBox は Button の Appearance を既定で持っているため、これはトグル ボタンとして表示されます。派生 Control.ControlAccessibleObject クラス MyCheckBoxControlAccessibleObject は、3 つのプロパティをオーバーライドして、表示の違いを考慮します。
Imports System Imports System.Windows.Forms Imports Accessibility Imports System.Drawing Namespace MyCustomControls Public Class MyCheckBox Inherits CheckBox Public Sub New() ' Make the check box appear like a toggle button. Me.Appearance = Appearance.Button ' Center the text on the button. Me.TextAlign = ContentAlignment.MiddleCenter End Sub ' Create an instance of the AccessibleObject ' defined for the 'MyCheckBox' control Protected Overrides Function CreateAccessibilityInstance() _ As AccessibleObject Return New MyCheckBoxAccessibleObject(Me) End Function End Class ' Accessible object for use with the 'MyCheckBox' control. Friend Class MyCheckBoxAccessibleObject Inherits Control.ControlAccessibleObject Public Sub New(owner As MyCheckBox) MyBase.New(owner) End Sub Public Overrides ReadOnly Property DefaultAction() As String Get ' Return the DefaultAction based upon ' the state of the control. If CType(Owner, MyCheckBox).Checked Then Return "Toggle button up" Else Return "Toggle button down" End If End Get End Property Public Overrides Property Name() As String Get ' Return the Text property of the control ' if the AccessibleName is null. Dim accessibleName As String = Owner.AccessibleName If Not (accessibleName Is Nothing) Then Return accessibleName End If Return CType(Owner, MyCheckBox).Text End Get Set MyBase.Name = value End Set End Property Public Overrides ReadOnly Property Role() As AccessibleRole Get ' Since the check box appears like a button, ' make the Role the same as a button. Return AccessibleRole.PushButton End Get End Property End Class End Namespace
using System; using System.Windows.Forms; using Accessibility; using System.Drawing; namespace MyCustomControls { public class MyCheckBox : CheckBox { public MyCheckBox() { // Make the check box appear like a toggle button. this.Appearance = Appearance.Button; // Center the text on the button. this.TextAlign = ContentAlignment.MiddleCenter; // Set the AccessibleDescription text. this.AccessibleDescription = "A toggle style button."; } // Create an instance of the AccessibleObject // defined for the 'MyCheckBox' control protected override AccessibleObject CreateAccessibilityInstance() { return new MyCheckBoxAccessibleObject(this); } } // Accessible object for use with the 'MyCheckBox' control. internal class MyCheckBoxAccessibleObject : Control.ControlAccessibleObject { public MyCheckBoxAccessibleObject(MyCheckBox owner) : base(owner) { } public override string DefaultAction { get { // Return the DefaultAction based upon // the state of the control. if( ((MyCheckBox)Owner).Checked ) { return "Toggle button up"; } else { return "Toggle button down"; } } } public override string Name { get { // Return the Text property of the control // if the AccessibleName is null. string name = Owner.AccessibleName; if (name != null) { return name; } return ((MyCheckBox)Owner).Text; } set { base.Name = value; } } public override AccessibleRole Role { get { // Since the check box appears like a button, // make the Role the same as a button. return AccessibleRole.PushButton; } } } }
#using <Accessibility.dll> #using <System.Drawing.dll> #using <System.dll> #using <System.Windows.Forms.dll> using namespace System; using namespace System::Windows::Forms; using namespace System::Drawing; namespace MyCustomControls { public ref class MyCheckBox: public CheckBox { public: MyCheckBox() { // Make the check box appear like a toggle button. this->Appearance = ::Appearance::Button; // Center the text on the button. this->TextAlign = ContentAlignment::MiddleCenter; // Set the AccessibleDescription text. this->AccessibleDescription = "A toggle style button."; } protected: // Create an instance of the AccessibleObject // defined for the 'MyCheckBox' control virtual AccessibleObject^ CreateAccessibilityInstance() override; }; // Accessible Object* for use with the 'MyCheckBox' control. private ref class MyCheckBoxAccessibleObject: public Control::ControlAccessibleObject { public: MyCheckBoxAccessibleObject( MyCheckBox^ owner ) : ControlAccessibleObject( owner ) {} property String^ DefaultAction { virtual String^ get() override { // Return the DefaultAction based upon // the state of the control. if ( (dynamic_cast<MyCheckBox^>(Owner))->Checked ) { return "Toggle button up"; } else { return "Toggle button down"; } } } property String^ Name { virtual String^ get() override { // Return the Text property of the control // if the AccessibleName is 0. String^ name = Owner->AccessibleName; if ( name != nullptr ) { return name; } return (dynamic_cast<MyCheckBox^>(Owner))->Text; } virtual void set( String^ value ) override { ControlAccessibleObject::Name = value; } } property AccessibleRole Role { virtual AccessibleRole get() override { // Since the check box appears like a button, // make the Role the same as a button. return AccessibleRole::PushButton; } } }; AccessibleObject^ MyCheckBox::CreateAccessibilityInstance() { return gcnew MyCheckBoxAccessibleObject( this ); } }
package MyCustomControls; import System.*; import System.Windows.Forms.*; import Accessibility.*; import System.Drawing.*; public class MyCheckBox extends CheckBox { public MyCheckBox() { // Make the check box appear like a toggle button. this.set_Appearance(get_Appearance().Button); // Center the text on the button. this.set_TextAlign(ContentAlignment.MiddleCenter); // Set the AccessibleDescription text. this.set_AccessibleDescription("A toggle style button."); } //MyCheckBox // Create an instance of the AccessibleObject // defined for the 'MyCheckBox' control protected AccessibleObject CreateAccessibilityInstance() { return new MyCheckBoxAccessibleObject(this); } //CreateAccessibilityInstance } //MyCheckBox // Accessible object for use with the 'MyCheckBox' control. class MyCheckBoxAccessibleObject extends Control.ControlAccessibleObject { public MyCheckBoxAccessibleObject(MyCheckBox owner) { super(owner); } //MyCheckBoxAccessibleObject /** @property */ public String get_DefaultAction() { // Return the DefaultAction based upon // the state of the control. if (((MyCheckBox)get_Owner()).get_Checked()) { return "Toggle button up"; } else { return "Toggle button down"; } } //get_DefaultAction /** @property */ public String get_Name() { // Return the Text property of the control // if the AccessibleName is null. String name = get_Owner().get_AccessibleName(); if (name != null) { return name; } return ((MyCheckBox)get_Owner()).get_Text(); } //get_Name /** @property */ public void set_Name(String value) { super.set_Name(value); } //set_Name /** @property */ public AccessibleRole get_Role() { // Since the check box appears like a button, // make the Role the same as a button. return AccessibleRole.PushButton; } //get_Role } //MyCheckBoxAccessibleObject

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Control.ControlAccessibleObject プロパティ

名前 | 説明 | |
---|---|---|
![]() | Bounds | ユーザー補助オブジェクトの位置とサイズを取得します。 ( AccessibleObject から継承されます。) |
![]() | DefaultAction | オーバーライドされます。 |
![]() | Description | オーバーライドされます。 Control.ControlAccessibleObject の説明を取得します。 |
![]() | Handle | ユーザー補助対象のオブジェクトのハンドルを取得または設定します。 |
![]() | Help | オーバーライドされます。 オブジェクトの機能または使用方法の説明を取得します。 |
![]() | KeyboardShortcut | オーバーライドされます。 ユーザー補助オブジェクトのオブジェクト ショートカット キーまたはアクセス キーを取得します。 |
![]() | Name | オーバーライドされます。 ユーザー補助オブジェクトの名前を取得または設定します。 |
![]() | Owner | ユーザー補助対象のオブジェクトの所有者を取得します。 |
![]() | Parent | オーバーライドされます。 |
![]() | Role | オーバーライドされます。 ユーザー補助オブジェクトの役割を取得します。 |
![]() | State | ユーザー補助オブジェクトの状態を取得します。 ( AccessibleObject から継承されます。) |
![]() | Value | ユーザー補助オブジェクトの値を取得または設定します。 ( AccessibleObject から継承されます。) |

Control.ControlAccessibleObject メソッド


名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | オーバーロードされます。 ( MarshalByRefObject から継承されます。) |
![]() | UseStdAccessibleObjects | オーバーロードされます。 オブジェクトを AccessibleObject のインスタンスに関連付けます。 ( AccessibleObject から継承されます。) |

Control.ControlAccessibleObject メンバ
ユーザー補助アプリケーションによって使用できるコントロールについての情報を提供します。
Control.ControlAccessibleObject データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | Bounds | ユーザー補助オブジェクトの位置とサイズを取得します。(AccessibleObject から継承されます。) |
![]() | DefaultAction | オーバーライドされます。 |
![]() | Description | オーバーライドされます。 Control.ControlAccessibleObject の説明を取得します。 |
![]() | Handle | ユーザー補助対象のオブジェクトのハンドルを取得または設定します。 |
![]() | Help | オーバーライドされます。 オブジェクトの機能または使用方法の説明を取得します。 |
![]() | KeyboardShortcut | オーバーライドされます。 ユーザー補助オブジェクトのオブジェクト ショートカット キーまたはアクセス キーを取得します。 |
![]() | Name | オーバーライドされます。 ユーザー補助オブジェクトの名前を取得または設定します。 |
![]() | Owner | ユーザー補助対象のオブジェクトの所有者を取得します。 |
![]() | Parent | オーバーライドされます。 |
![]() | Role | オーバーライドされます。 ユーザー補助オブジェクトの役割を取得します。 |
![]() | State | ユーザー補助オブジェクトの状態を取得します。(AccessibleObject から継承されます。) |
![]() | Value | ユーザー補助オブジェクトの値を取得または設定します。(AccessibleObject から継承されます。) |


名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | オーバーロードされます。 ( MarshalByRefObject から継承されます。) |
![]() | UseStdAccessibleObjects | オーバーロードされます。 オブジェクトを AccessibleObject のインスタンスに関連付けます。 (AccessibleObject から継承されます。) |

Weblioに収録されているすべての辞書からControl.ControlAccessibleObjectを検索する場合は、下記のリンクをクリックしてください。

- Control.ControlAccessibleObjectのページへのリンク