ToolStripMenuItem::CreateAccessibilityInstance Method ()

 

Creates a new accessibility object for the ToolStripMenuItem.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

protected:
virtual AccessibleObject^ CreateAccessibilityInstance() override

The following code example demonstrates overriding the CreateAccessibilityInstance method to create an accessibility-aware chart control, using the AccessibleObject and Control::ControlAccessibleObject classes to expose accessible information. The control plots two curves along with a legend. The ChartControlAccessibleObject class, which derives from ControlAccessibleObject, is used in the CreateAccessibilityInstance method to provide custom accessible information for the chart control. Because the chart legend is not an actual Control-based control, but instead is drawn by the chart control, it does not any built-in accessible information. 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.

This code example is part of a complete code example that can be found at the AccessibleObject class overview.

protected:
   // Overridden to return the custom AccessibleObject
   // for the entire chart.
   virtual AccessibleObject^ CreateAccessibilityInstance() override
   {
      return gcnew ChartControlAccessibleObject( this );
   }

.NET Framework
Available since 2.0
Return to top
Show: