AccessibleObject.Navigate(AccessibleNavigation) AccessibleObject.Navigate(AccessibleNavigation) AccessibleObject.Navigate(AccessibleNavigation) AccessibleObject.Navigate(AccessibleNavigation) Method

定義

他のユーザー補助オブジェクトに移動します。Navigates to another accessible object.

public:
 virtual System::Windows::Forms::AccessibleObject ^ Navigate(System::Windows::Forms::AccessibleNavigation navdir);
public virtual System.Windows.Forms.AccessibleObject Navigate (System.Windows.Forms.AccessibleNavigation navdir);
abstract member Navigate : System.Windows.Forms.AccessibleNavigation -> System.Windows.Forms.AccessibleObject
override this.Navigate : System.Windows.Forms.AccessibleNavigation -> System.Windows.Forms.AccessibleObject
Public Overridable Function Navigate (navdir As AccessibleNavigation) As AccessibleObject

パラメーター

戻り値

例外

ナビゲーションに失敗します。The navigation attempt fails.

次の例では、ユーザー補助対応のグラフの作成を使用して、制御、AccessibleObjectControl.ControlAccessibleObjectアクセス可能な情報を公開するクラス。The following example demonstrates the creation of an accessibility-aware chart control, using the AccessibleObject and Control.ControlAccessibleObject classes to expose accessible information. コントロールは、凡例と共に 2 つの曲線をプロットします。The control plots two curves along with a legend. ChartControlAccessibleObjectから派生したクラスControlAccessibleObjectで使用されて、CreateAccessibilityInstanceグラフ コントロールのカスタムのアクセス可能な情報を提供するメソッド。The ChartControlAccessibleObject class, which derives from ControlAccessibleObject, is used in the CreateAccessibilityInstance method to provide custom accessible information for the chart control. グラフの凡例は、実際はないためControl-ベースの制御が描画される代わりに、組み込みのアクセス可能な情報がない、グラフ コントロールでします。Since the chart legend is not an actual Control -based control, but instead is drawn by the chart control, it does not have any built-in accessible information. このため、ChartControlAccessibleObjectオーバーライド、GetChildを返すメソッドをCurveLegendAccessibleObject凡例の各部分にアクセスできる情報を表します。Because of this, the ChartControlAccessibleObject class overrides the GetChild method to return the CurveLegendAccessibleObject that represents accessible information for each part of the legend. ユーザー補助対応アプリケーションでは、このコントロールを使用すると、コントロールは、アクセスに必要な情報を提供できます。When an accessible-aware application uses this control, the control can provide the necessary accessible information.

この例でのオーバーライドを示しています、Navigateメソッド。This code demonstrates shows overriding the Navigate method. 参照してください、AccessibleObject完全なコード例では、クラスの概要。See the AccessibleObject class overview for the complete code example.

   // Inner class CurveLegendAccessibleObject represents accessible information
   // associated with the CurveLegend object.
public:
   ref class CurveLegendAccessibleObject: public AccessibleObject
   {
   private:
      CurveLegend^ curveLegend;

   public:
      CurveLegendAccessibleObject( CurveLegend^ curveLegend )
         : AccessibleObject()
      {
         this->curveLegend = curveLegend;
      }


   private:

      property ChartControlAccessibleObject^ ChartControl 
      {

         // Private property that helps get the reference to the parent ChartControl.
         ChartControlAccessibleObject^ get()
         {
            return dynamic_cast<ChartControlAccessibleObject^>(Parent);
         }

      }

   internal:

      property int ID 
      {

         // Internal helper function that returns the ID for this CurveLegend.
         int get()
         {
            for ( int i = 0; i < ChartControl->GetChildCount(); i++ )
            {
               if ( ChartControl->GetChild( i ) == this )
               {
                  return i;
               }

            }
            return  -1;
         }

      }

   public:

      property Rectangle Bounds 
      {

         // Gets the Bounds for the CurveLegend. This is used by accessibility programs.
         virtual Rectangle get() override
         {
            
            // The bounds is in screen coordinates.
            Point loc = curveLegend->Location;
            return Rectangle(curveLegend->chart->PointToScreen( loc ),curveLegend->Size);
         }

      }

      property String^ Name 
      {

         // Gets or sets the Name for the CurveLegend. This is used by accessibility programs.
         virtual String^ get() override
         {
            return curveLegend->Name;
         }

         virtual void set( String^ value ) override
         {
            curveLegend->Name = value;
         }

      }

      property AccessibleObject^ Parent 
      {

         // Gets the Curve Legend Parent's Accessible object.
         // This is used by accessibility programs.
         virtual AccessibleObject^ get() override
         {
            return curveLegend->chart->AccessibilityObject;
         }

      }

      property System::Windows::Forms::AccessibleRole Role 
      {

         // Gets the role for the CurveLegend. This is used by accessibility programs.
         virtual System::Windows::Forms::AccessibleRole get() override
         {
            return ::AccessibleRole::StaticText;
         }

      }

      property AccessibleStates State 
      {

         // Gets the state based on the selection for the CurveLegend.
         // This is used by accessibility programs.
         virtual AccessibleStates get() override
         {
            AccessibleStates state = AccessibleStates::Selectable;
            if ( curveLegend->Selected )
            {
               state = static_cast<AccessibleStates>(state | AccessibleStates::Selected);
            }

            return state;
         }

      }

      // Navigates through siblings of this CurveLegend. This is used by accessibility programs.
      virtual AccessibleObject^ Navigate( AccessibleNavigation navdir ) override
      {
         
         // Uses the internal NavigateFromChild helper function that exists
         // on ChartControlAccessibleObject.
         return ChartControl->NavigateFromChild( this, navdir );
      }


      // Selects or unselects this CurveLegend. This is used by accessibility programs.
      virtual void Select( AccessibleSelection selection ) override
      {
         
         // Uses the internal SelectChild helper function that exists
         // on ChartControlAccessibleObject.
         ChartControl->SelectChild( this, selection );
      }

   };
// Inner class CurveLegendAccessibleObject represents accessible information 
// associated with the CurveLegend object.
public class CurveLegendAccessibleObject : AccessibleObject
{
    private CurveLegend curveLegend;

    public CurveLegendAccessibleObject(CurveLegend curveLegend) : base() 
    {
        this.curveLegend = curveLegend;                    
    }                

    // Private property that helps get the reference to the parent ChartControl.
    private ChartControlAccessibleObject ChartControl
    {   
        get {
            return Parent as ChartControlAccessibleObject;
        }
    }

    // Internal helper function that returns the ID for this CurveLegend.
    internal int ID
    {
        get {
            for(int i = 0; i < ChartControl.GetChildCount(); i++) {
                if (ChartControl.GetChild(i) == this) {
                    return i;
                }
            }
            return -1;
        }
    }

    // Gets the Bounds for the CurveLegend. This is used by accessibility programs.
    public override Rectangle Bounds
    {
        get {                        
            // The bounds is in screen coordinates.
            Point loc = curveLegend.Location;
            return new Rectangle(curveLegend.chart.PointToScreen(loc), curveLegend.Size);
        }
    }

    // Gets or sets the Name for the CurveLegend. This is used by accessibility programs.
    public override string Name
    {
        get {
            return curveLegend.Name;
        }
        set {
            curveLegend.Name = value;                        
        }
    }

    // Gets the Curve Legend Parent's Accessible object.
    // This is used by accessibility programs.
    public override AccessibleObject Parent
    {
        get {
            return curveLegend.chart.AccessibilityObject;
        }
    }

    // Gets the role for the CurveLegend. This is used by accessibility programs.
    public override AccessibleRole Role 
    {
        get {
            return AccessibleRole.StaticText;
        }
    }

    // Gets the state based on the selection for the CurveLegend. 
    // This is used by accessibility programs.
    public override AccessibleStates State 
    {
        get {
            AccessibleStates state = AccessibleStates.Selectable;
            if (curveLegend.Selected) 
            {
                state |= AccessibleStates.Selected;
            }
            return state;
        }
    }

    // Navigates through siblings of this CurveLegend. This is used by accessibility programs.
    public override AccessibleObject Navigate(AccessibleNavigation navdir) 
    {
        // Uses the internal NavigateFromChild helper function that exists
        // on ChartControlAccessibleObject.
        return ChartControl.NavigateFromChild(this, navdir);
    }

    // Selects or unselects this CurveLegend. This is used by accessibility programs.
    public override void Select(AccessibleSelection selection) 
    {
        // Uses the internal SelectChild helper function that exists
        // on ChartControlAccessibleObject.
        ChartControl.SelectChild(this, selection);
    }
}
' Inner class CurveLegendAccessibleObject represents accessible information 
' associated with the CurveLegend object.
Public Class CurveLegendAccessibleObject
    Inherits AccessibleObject

    Private curveLegend As CurveLegend
    
    Public Sub New(curveLegend As CurveLegend)
        Me.curveLegend = curveLegend
    End Sub 'New
    
    ' Private property that helps get the reference to the parent ChartControl.                
    Private ReadOnly Property ChartControl() As ChartControlAccessibleObject
        Get
            Return CType(Parent, ChartControlAccessibleObject)
        End Get
    End Property

    ' Friend helper function that returns the ID for this CurveLegend.                
    Friend ReadOnly Property ID() As Integer
        Get
            Dim i As Integer
            For i = 0 To (ChartControl.GetChildCount()) - 1
                If ChartControl.GetChild(i) Is Me Then
                    Return i
                End If
            Next i
            Return - 1
        End Get
    End Property
    
    ' Gets the Bounds for the CurveLegend. This is used by accessibility programs.
    Public Overrides ReadOnly Property Bounds() As Rectangle
        Get
            ' The bounds is in screen coordinates.
            Dim loc As Point = curveLegend.Location
            Return New Rectangle(curveLegend.chart.PointToScreen(loc), curveLegend.Size)
        End Get
    End Property

    ' Gets or sets the Name for the CurveLegend. This is used by accessibility programs.                
    Public Overrides Property Name() As String
        Get
            Return curveLegend.Name
        End Get
        Set
            curveLegend.Name = value
        End Set
    End Property
    
    ' Gets the Curve Legend Parent's Accessible object.
    ' This is used by accessibility programs.                
    Public Overrides ReadOnly Property Parent() As AccessibleObject
        Get
            Return curveLegend.chart.AccessibilityObject
        End Get
    End Property
    
    ' Gets the role for the CurveLegend. This is used by accessibility programs.                
    Public Overrides ReadOnly Property Role() As AccessibleRole
        Get
            Return System.Windows.Forms.AccessibleRole.StaticText
        End Get
    End Property

    ' Gets the state based on the selection for the CurveLegend. 
    ' This is used by accessibility programs.                
    Public Overrides ReadOnly Property State() As AccessibleStates
        Get
            Dim stateTemp As AccessibleStates = AccessibleStates.Selectable
            If curveLegend.Selected Then
                stateTemp = stateTemp Or AccessibleStates.Selected
            End If
            Return stateTemp
        End Get
    End Property
    
    ' Navigates through siblings of this CurveLegend. This is used by accessibility programs.                
    Public Overrides Function Navigate(navdir As AccessibleNavigation) As AccessibleObject
        ' Use the Friend NavigateFromChild helper function that exists
        ' on ChartControlAccessibleObject.
        Return ChartControl.NavigateFromChild(Me, navdir)
    End Function
    
    ' Selects or unselects this CurveLegend. This is used by accessibility programs.
    Public Overrides Sub [Select](selection As AccessibleSelection)

        ' Use the internal SelectChild helper function that exists
        ' on ChartControlAccessibleObject.
        ChartControl.SelectChild(Me, selection)
    End Sub

End Class 'CurveLegendAccessibleObject

注釈

ナビゲーション、空間と、論理は、常に、コンテナー内のユーザー インターフェイス要素に制限します。Navigation, both spatial and logical, is always restricted to the user interface elements within a container. 空間のナビゲーションでは、クライアントが開始オブジェクトの兄弟にのみ移動できます。With spatial navigation, clients can navigate only to a sibling of the starting object. 論理ナビゲーションに使用される、ナビゲーション フラグによって、クライアントはまたは開始オブジェクトの兄弟のいずれかの子を移動できます。Depending on the navigational flag used with logical navigation, clients can navigate to either a child or to a sibling of the starting object. このメソッドは、選択またはフォーカスは変更されません。This method does not change the selection or focus. フォーカスを変更するか、オブジェクトを選択するを使用して、Selectします。To change the focus or to select an object, use Select. Navigateメソッドが定義されている画面の場所が、ユーザー インターフェイス要素のみを取得します。The Navigate method retrieves only user interface elements that have a defined screen location.

注意 (継承者)

すべてのビジュアル オブジェクトは、このメソッドをサポートする必要があります。All visual objects must support this method. オブジェクトの状態を持つ場合Invisible、この非表示のオブジェクトへの移動が失敗する可能性があります。If an object has the state Invisible, navigation to this hidden object might fail. メニュー、メニュー アイテムをポップアップ メニューなどの一部のシステム定義のインターフェイス要素では、表示されていないオブジェクトへの移動を許可します。Some system-defined interface elements such as menus, menu items, and pop-up menus allow navigation to objects that are not visible. ただし、その他のシステム定義のユーザー インターフェイス要素では、このサポートしていません。However, other system-defined user interface elements do not support this. 可能であれば、サーバーでは表示されず、オブジェクトへのナビゲーションをサポートする必要がありますが、このサポートは必要ありませんし、クライアントは期待できません。If possible, servers should support navigation to objects that are not visible, but this support is not required and clients should not expect it.

適用対象