この記事は翻訳者によって翻訳されたものです。 記事の文章にポインターを重ねると、原文のテキストが表示されます。
訳文
原文
このトピックはまだ評価されていません - このトピックを評価する

AccessibleObject クラス

障害を持つユーザーに合わせてアプリケーションのユーザー インターフェイス (UI) を調整するために、ユーザー補助アプリケーションが使用する情報を提供します。

System.Object
  System.MarshalByRefObject
    System.Runtime.InteropServices.StandardOleMarshalObject
      System.Windows.Forms.AccessibleObject
        詳細...

名前空間:  System.Windows.Forms
アセンブリ:  System.Windows.Forms (System.Windows.Forms.dll 内)
[ComVisibleAttribute(true)]
public class AccessibleObject : StandardOleMarshalObject, 
	IReflect, IAccessible

AccessibleObject 型で公開されるメンバーは以下のとおりです。

  名前 説明
パブリック メソッド AccessibleObject AccessibleObject クラスの新しいインスタンスを初期化します。
このページのトップへ
  名前 説明
パブリック プロパティ Bounds ユーザー補助オブジェクトの位置とサイズを取得します。
パブリック プロパティ DefaultAction オブジェクトの既定のアクションを説明する文字列を取得します。 既定のアクションがないオブジェクトもあります。
パブリック プロパティ Description 指定したオブジェクトの外観を説明する文字列を取得します。 説明が用意されていないオブジェクトもあります。
パブリック プロパティ Help オブジェクトの機能または使用方法の説明を取得します。
パブリック プロパティ KeyboardShortcut ユーザー補助オブジェクトのショートカット キーまたはアクセス キーを取得します。
パブリック プロパティ Name オブジェクト名を取得または設定します。
パブリック プロパティ Parent ユーザー補助オブジェクトの親を取得します。
パブリック プロパティ Role ユーザー補助オブジェクトの役割を取得します。
パブリック プロパティ State ユーザー補助オブジェクトの状態を取得します。
パブリック プロパティ Value ユーザー補助オブジェクトの値を取得または設定します。
このページのトップへ
  名前 説明
パブリック メソッド CreateObjRef リモート オブジェクトとの通信に使用するプロキシの生成に必要な情報をすべて格納しているオブジェクトを作成します。 (MarshalByRefObject から継承されます。)
パブリック メソッド DoDefaultAction ユーザー補助オブジェクトに関連付けられた既定のアクションを実行します。
パブリック メソッド Equals(Object) 指定した Object が、現在の Object と等しいかどうかを判断します。 (Object から継承されます。)
プロテクト メソッド Finalize オブジェクトがガベジ コレクションにより収集される前に、そのオブジェクトがリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。)
パブリック メソッド GetChild 指定したインデックスに対応する子ユーザー補助オブジェクトを取得します。
パブリック メソッド GetChildCount ユーザー補助オブジェトに属する子の数を取得します。
パブリック メソッド GetFocused キーボード フォーカスを持つオブジェクトを取得します。
パブリック メソッド GetHashCode 特定の型のハッシュ関数として機能します。 (Object から継承されます。)
パブリック メソッド GetHelpTopic ヘルプ トピックの識別子と、このユーザー補助オブジェクトに関連付けられたヘルプ ファイルへのパスを取得します。
パブリック メソッド GetLifetimeService 対象のインスタンスの有効期間ポリシーを制御する、現在の有効期間サービス オブジェクトを取得します。 (MarshalByRefObject から継承されます。)
パブリック メソッド GetSelected 現在選択されている子を取得します。
パブリック メソッド GetType 現在のインスタンスの Type を取得します。 (Object から継承されます。)
パブリック メソッド HitTest 指定した画面座標にある子オブジェクトを取得します。
パブリック メソッド InitializeLifetimeService 対象のインスタンスの有効期間ポリシーを制御する、有効期間サービス オブジェクトを取得します。 (MarshalByRefObject から継承されます。)
プロテクト メソッド MemberwiseClone() 現在の Object の簡易コピーを作成します。 (Object から継承されます。)
プロテクト メソッド MemberwiseClone(Boolean) 現在の MarshalByRefObject オブジェクトの簡易コピーを作成します。 (MarshalByRefObject から継承されます。)
パブリック メソッド Navigate 他のユーザー補助オブジェクトに移動します。
パブリック メソッド Select ユーザー補助オブジェクトの選択項目の修正またはキーボード フォーカスの移動を行います。
パブリック メソッド ToString 現在のオブジェクトを表す文字列を返します。 (Object から継承されます。)
プロテクト メソッド UseStdAccessibleObjects(IntPtr) インフラストラクチャ。 オブジェクトのハンドルに基づき、オブジェクトを AccessibleObject のインスタンスに関連付けます。
プロテクト メソッド UseStdAccessibleObjects(IntPtr, Int32) インフラストラクチャ。 オブジェクトのハンドルと ID に基づき、オブジェクトを AccessibleObject のインスタンスに関連付けます。
このページのトップへ
  名前 説明
明示的なインターフェイス実装 プライベート プロパティ IAccessible.accChildCount インフラストラクチャ。 このオブジェクトに属する子インターフェイスの数を取得します。 このメンバーの説明については、IAccessible.accChildCount のトピックを参照してください。
明示的なインターフェイス実装 プライベート メソッド IAccessible.accDoDefaultAction インフラストラクチャ。 指定したオブジェクトの既定のアクションを実行します。 既定のアクションがないオブジェクトもあります。 このメンバーの説明については、IAccessible.accDoDefaultAction のトピックを参照してください。
明示的なインターフェイス実装 プライベート プロパティ IAccessible.accFocus インフラストラクチャ。 キーボード フォーカスを持つオブジェクトを取得します。 このメンバーの説明については、IAccessible.accFocus のトピックを参照してください。
明示的なインターフェイス実装 プライベート メソッド IAccessible.accHitTest インフラストラクチャ。 指定した画面座標にある子オブジェクトを取得します。 このメンバーの説明については、IAccessible.accHitTest のトピックを参照してください。
明示的なインターフェイス実装 プライベート メソッド IAccessible.accLocation インフラストラクチャ。 オブジェクトの現在の画面位置を取得します。 このメンバーの説明については、IAccessible.accLocation のトピックを参照してください。
明示的なインターフェイス実装 プライベート メソッド IAccessible.accNavigate インフラストラクチャ。 現在のオブジェクトを基準としてユーザー補助オブジェクトに移動します。 このメンバーの説明については、IAccessible.accNavigate のトピックを参照してください。
明示的なインターフェイス実装 プライベート プロパティ IAccessible.accParent インフラストラクチャ。 このオブジェクトの親ユーザー補助オブジェクトを取得します。 このメンバーの説明については、IAccessible.accParent のトピックを参照してください。
明示的なインターフェイス実装 プライベート メソッド IAccessible.accSelect インフラストラクチャ。 ユーザー補助オブジェクトの選択項目の修正またはキーボード フォーカスの移動を行います。 このメンバーの説明については、IAccessible.accSelect のトピックを参照してください。
明示的なインターフェイス実装 プライベート プロパティ IAccessible.accSelection インフラストラクチャ。 ユーザー補助オブジェクトの選択された子オブジェクトを取得します。 このメンバーの説明については、IAccessible.accSelection のトピックを参照してください。
明示的なインターフェイス実装 プライベート メソッド IReflect.GetField インフラストラクチャ。 指定したフィールドとバインディング フラグに対応する System.Reflection.FieldInfo オブジェクトを取得します。 このメンバーの説明については、IReflect.GetField のトピックを参照してください。
明示的なインターフェイス実装 プライベート メソッド IReflect.GetFields インフラストラクチャ。 現在のクラスのすべてのフィールドに対応する System.Reflection.FieldInfo オブジェクトの配列を取得します。 このメンバーの説明については、IReflect.GetFields のトピックを参照してください。
明示的なインターフェイス実装 プライベート メソッド IReflect.GetMember インフラストラクチャ。 すべてのパブリック メンバーまたは指定した名前と一致するすべてのメンバーに対応する System.Reflection.MemberInfo オブジェクトの配列を取得します。 このメンバーの説明については、IReflect.GetMember のトピックを参照してください。
明示的なインターフェイス実装 プライベート メソッド IReflect.GetMembers インフラストラクチャ。 すべてのパブリック メンバーまたは現在のクラスのすべてのメンバーに対応する System.Reflection.MemberInfo オブジェクトの配列を取得します。 このメンバーの説明については、IReflect.GetMembers のトピックを参照してください。
明示的なインターフェイス実装 プライベート メソッド IReflect.GetMethod(String, BindingFlags) インフラストラクチャ。 指定した検索制約の下で、指定したメソッドに対応する System.Reflection.MethodInfo オブジェクトを取得します。 このメンバーの説明については、IReflect.GetMethod のトピックを参照してください。
明示的なインターフェイス実装 プライベート メソッド IReflect.GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[]) インフラストラクチャ。 オーバーロードされたメソッドの中から選択する Type 配列を使用して、指定したメソッドに対応する System.Reflection.MethodInfo オブジェクトを取得します。 このメンバーの説明については、IReflect.GetMethod のトピックを参照してください。
明示的なインターフェイス実装 プライベート メソッド IReflect.GetMethods インフラストラクチャ。 すべてのパブリック メソッドまたは現在のクラスのすべてのメソッドの System.Reflection.MethodInfo オブジェクトの配列を取得します。 このメンバーの説明については、IReflect.GetMethods のトピックを参照してください。
明示的なインターフェイス実装 プライベート メソッド IReflect.GetProperties インフラストラクチャ。 すべてのパブリック プロパティまたは現在のクラスのすべてのプロパティに対応する System.Reflection.PropertyInfo オブジェクトの配列を取得します。 このメンバーの説明については、IReflect.GetProperties のトピックを参照してください。
明示的なインターフェイス実装 プライベート メソッド IReflect.GetProperty(String, BindingFlags) インフラストラクチャ。 指定した検索制約の下で、指定したプロパティに対応する System.Reflection.PropertyInfo オブジェクトを取得します。 このメンバーの説明については、IReflect.GetProperty のトピックを参照してください。
明示的なインターフェイス実装 プライベート メソッド IReflect.GetProperty(String, BindingFlags, Binder, Type, Type[], ParameterModifier[]) インフラストラクチャ。 指定した検索制約で、指定したプロパティに対応する System.Reflection.PropertyInfo オブジェクトを取得します。 このメンバーの説明については、IReflect.GetProperty のトピックを参照してください。
明示的なインターフェイス実装 プライベート メソッド IReflect.InvokeMember インフラストラクチャ。 指定されたメンバーを呼び出します。 このメンバーの説明については、IReflect.InvokeMember のトピックを参照してください。
明示的なインターフェイス実装 プライベート プロパティ IReflect.UnderlyingSystemType インフラストラクチャ。 IReflect オブジェクトを表す基になる型を取得します。 このメンバーの説明については、IReflect.UnderlyingSystemType のトピックを参照してください。
このページのトップへ

ユーザー補助アプリケーションでは、アプリケーションの機能を調整することによって、障害を持つユーザーの利便を高めることができます。

視覚障害のあるユーザーに対しては、ソフトウェアおよびオペレーティング システムの機能を必要に合わせて調整できます。 たとえば、テキストやイメージを拡大したり、コントラストを強調して表示したりできます。 また、色覚障碍のユーザーには、適切な配色を使用できます。 重度の視覚障害があるユーザーに対しては、コンピューターから、画面表示を支援する装置にアクセスできる機能を提供します。これによって、画面上のテキストを、音声または動的に表示が変更する点字ディスプレイに変換できます。

聴覚に障害のあるユーザーに対しては、点滅ツール バーなど、視覚効果のある UI をプログラムに取り入れたり、音声メッセージをテキストとして表示したりできます。 たとえば、コントロール パネルのユーザー補助オプションである SoundSentry 機能を有効にすると、警告音を画面表示に反映できます。

身体的な障害のあるユーザーに対しては、キーボードおよびマウス操作を簡単にしたり不要にしたりするようにコントロールを設計することによって、コンピューターを使いやすくすることができます。 コントロール パネルには支援機能が用意されています。 たとえば、マウス ポインターの操作に、マウスの代わりにテンキーを使用できます。 Ctrl キーを押しながら P キーを押すなど、2 つ以上のキーを同時に押すことができない場合は、StickyKeys オプションを使用すると、キーを 1 つずつ押すことによって同じ操作ができるようになります。

知覚障害や言語障害のあるユーザーに対しては、ソフトウェア プログラムの設計によって利便性を向上できます。 たとえば、常に次の操作がわかるように工夫する、表示を簡略化する、単語を少なくする、小学生でも理解できる文章にするなどの対応が有効です。

発作性の障害のあるユーザーに対しては、発作の原因となるようなパターンを削除したソフトウェア プログラムを設計できます。

ユーザー補助アプリケーションに関する情報など、ユーザー補助の詳細については、MSDN ライブラリまたは Microsoft の Web サイトで Microsoft Accessibility に関するドキュメントを参照してください。

メモ メモ

AccessibleObject を使用するには、.NET Framework と一緒にインストールされる Accessibility アセンブリへの参照を追加する必要があります。 Windows フォームは、Active Accessibility 2.0 のみをサポートしています。

継承時の注意

このクラスから継承する場合は、すべてのメンバーをオーバーライドできます。

ユーザー補助情報を公開する AccessibleObject クラスおよび Control.ControlAccessibleObject クラスを使用して、ユーザー補助対応のチャート コントロールを作成する方法の例を次に示します。 コントロールは、凡例に沿って 2 つの曲線をプロットします。 ControlAccessibleObject から派生された ChartControlAccessibleObject クラスは、チャート コントロールの独自のユーザー補助情報を提供することを目的として、CreateAccessibilityInstance メソッドで使用します。 チャートの凡例は実際の Control ベースのコントロールではなく、チャート コントロールによって描画されるため、組み込みのユーザー補助情報は含まれていません。 このため、ChartControlAccessibleObject クラスは、GetChild メソッドをオーバーライドして、凡例の各部分のユーザー補助情報を表す CurveLegendAccessibleObject を返します。 ユーザー補助対応のアプリケーションでこのコントロールが使用された場合、このコントロールは必要なユーザー補助情報を提供できます。


using System;
using System.Drawing;
using System.Windows.Forms;

namespace ChartControl
{
    public class Form1 : System.Windows.Forms.Form
    {
        // Test out the Chart Control.
        private ChartControl chart1;

        [STAThread]
        static void Main() 
        {
            Application.Run(new Form1());
        }

        public Form1() {
            // Create a chart control and add it to the form.
            this.chart1 = new ChartControl();
            this.ClientSize = new System.Drawing.Size(920, 566);

            this.chart1.Location = new System.Drawing.Point(47, 16);
            this.chart1.Size = new System.Drawing.Size(600, 400);

            this.Controls.Add(this.chart1);
        }
    }

    // Declare a chart control that demonstrates accessibility in Windows Forms.
    public class ChartControl : System.Windows.Forms.UserControl
    {
        private CurveLegend legend1;
        private CurveLegend legend2; 

        public ChartControl()
        {
            // The ChartControl draws the chart in the OnPaint override.
            SetStyle(ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.DoubleBuffer, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);

            this.BackColor = System.Drawing.Color.White;
            this.Name = "ChartControl";

            this.Click += new System.EventHandler(this.ChartControl_Click);
            this.QueryAccessibilityHelp += 
                new System.Windows.Forms.QueryAccessibilityHelpEventHandler(
                                        this.ChartControl_QueryAccessibilityHelp);

            // The CurveLengend is not Control-based, it just
            // represents the parts of the legend.
            legend1 = new CurveLegend(this, "A");
            legend1.Location = new Point(20, 30);
            legend2 = new CurveLegend(this, "B");        
            legend2.Location = new Point(20, 50);
        }

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

        protected override void OnPaint(PaintEventArgs e) 
        {
            // The ChartControl draws the chart in the OnPaint override.
            base.OnPaint(e);

            Rectangle bounds = this.ClientRectangle;
            int border = 5;

            // Draws the legends first.
            StringFormat format = new StringFormat();
            format.Alignment = StringAlignment.Center;
            format.LineAlignment = StringAlignment.Center;

            if (legend1 != null) {
                if (legend1.Selected) {
                    e.Graphics.FillRectangle(new SolidBrush(Color.Blue), legend1.Bounds);
                } else {
                    e.Graphics.DrawRectangle(Pens.Blue, legend1.Bounds);
                }

                e.Graphics.DrawString(legend1.Name, this.Font, Brushes.Black, legend1.Bounds, format);                
            }
            if (legend2 != null) {
                if (legend2.Selected) {
                    e.Graphics.FillRectangle(new SolidBrush(Color.Red), legend2.Bounds);
                } else {
                    e.Graphics.DrawRectangle(Pens.Red, legend2.Bounds);
                }
                e.Graphics.DrawString(legend2.Name, this.Font, Brushes.Black, legend2.Bounds, format);
            }            

            // Charts out the actual curves that represent data in the Chart.
            bounds.Inflate(-border, -border);
            Point[] curve1 = new Point[] {new Point(bounds.Left, bounds.Bottom),
                            new Point(bounds.Left + bounds.Width / 3, bounds.Top + bounds.Height / 5),
                            new Point(bounds.Right - bounds.Width / 3, (bounds.Top + bounds.Bottom) / 2),
                            new Point(bounds.Right, bounds.Top)};

            Point[] curve2 = new Point[] {new Point(bounds.Left, bounds.Bottom - bounds.Height / 3),
                            new Point(bounds.Left + bounds.Width / 3, bounds.Top + bounds.Height / 5),
                            new Point(bounds.Right - bounds.Width / 3, (bounds.Top + bounds.Bottom) / 2),
                            new Point(bounds.Right, bounds.Top + bounds.Height / 2)};

            // Draws the actual curve only if it is selected.
            if (legend1.Selected) e.Graphics.DrawCurve(Pens.Blue, curve1);
            if (legend2.Selected) e.Graphics.DrawCurve(Pens.Red, curve2);

            e.Graphics.DrawRectangle(Pens.Blue, bounds);            
        }

        // Handles the QueryAccessibilityHelp event.
        private void ChartControl_QueryAccessibilityHelp(object sender, 
                                    System.Windows.Forms.QueryAccessibilityHelpEventArgs e)
        {            
            e.HelpString = "Displays chart data";
        }          

        // Handles the Click event for the chart. 
        // Toggles the selection of whatever legend was clicked on
        private void ChartControl_Click(object sender, System.EventArgs e)
        {
            Point pt = this.PointToClient(Control.MousePosition);
            if (legend1.Bounds.Contains(pt)) {
                legend1.Selected = !legend1.Selected;

            } else if (legend2.Bounds.Contains(pt)) {
                legend2.Selected = !legend2.Selected;
            }
        }

        // Gets an array of CurveLengends used in the Chart.
        public CurveLegend[] Legends
        {   
            get {                
                return new CurveLegend[] { legend1, legend2 };
            }            
        }                

        // Inner class ChartControlAccessibleObject represents accessible information associated with the ChartControl.
        // The ChartControlAccessibleObject is returned in the ChartControl.CreateAccessibilityInstance override.
        public class ChartControlAccessibleObject : ControlAccessibleObject
        {
            ChartControl chartControl;

            public ChartControlAccessibleObject(ChartControl ctrl) : base(ctrl) 
            {
                chartControl = ctrl;
            }

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

            // Gets the state for the Chart. This is used by accessibility programs.
            public override AccessibleStates State
            {  
                get {                    
                    return AccessibleStates.ReadOnly;
                }
            }

            // The CurveLegend objects are "child" controls in terms of accessibility so 
            // return the number of ChartLengend objects.
            public override int GetChildCount()
            {  
                return chartControl.Legends.Length;
            }

            // Gets the Accessibility object of the child CurveLegend idetified by index.
            public override AccessibleObject GetChild(int index)
            {  
                if (index >= 0 && index < chartControl.Legends.Length) {
                    return chartControl.Legends[index].AccessibilityObject;
                }                
                return null;
            }

            // Helper function that is used by the CurveLegend's accessibility object
            // to navigate between sibiling controls. Specifically, this function is used in
            // the CurveLegend.CurveLegendAccessibleObject.Navigate function.
            internal AccessibleObject NavigateFromChild(CurveLegend.CurveLegendAccessibleObject child, 
                                                        AccessibleNavigation navdir) 
            {  
                switch(navdir) {
                    case AccessibleNavigation.Down:
                    case AccessibleNavigation.Next:
                        return GetChild(child.ID + 1);

                    case AccessibleNavigation.Up:
                    case AccessibleNavigation.Previous:
                        return GetChild(child.ID - 1);                        
                }
                return null;
            }

            // Helper function that is used by the CurveLegend's accessibility object
            // to select a specific CurveLegend control. Specifically, this function is used
            // in the CurveLegend.CurveLegendAccessibleObject.Select function.
            internal void SelectChild(CurveLegend.CurveLegendAccessibleObject child, AccessibleSelection selection) 
            {   
                int childID = child.ID;

                // Determine which selection action should occur, based on the
                // AccessibleSelection value.
                if ((selection & AccessibleSelection.TakeSelection) != 0) {
                    for(int i = 0; i < chartControl.Legends.Length; i++) {
                        if (i == childID) {
                            chartControl.Legends[i].Selected = true;                        
                        } else {
                            chartControl.Legends[i].Selected = false;
                        }
                    }

                    // AccessibleSelection.AddSelection means that the CurveLegend will be selected.
                    if ((selection & AccessibleSelection.AddSelection) != 0) {
                        chartControl.Legends[childID].Selected = true;                        
                    }

                    // AccessibleSelection.AddSelection means that the CurveLegend will be unselected.
                    if ((selection & AccessibleSelection.RemoveSelection) != 0) {
                        chartControl.Legends[childID].Selected = false;                        
                    }
                }            
            }
        }

        // Inner Class that represents a legend for a curve in the chart.
        public class CurveLegend 
        {
            private string name;
            private ChartControl chart;
            private CurveLegendAccessibleObject accObj;
            private bool selected = true;
            private Point location;

            public CurveLegend(ChartControl chart, string name) 
            {
                this.chart = chart;
                this.name = name;
            }

            // Gets the accessibility object for the curve legend.
            public AccessibleObject AccessibilityObject
            {
                get {
                    if (accObj == null) {
                        accObj = new CurveLegendAccessibleObject(this);
                    }
                    return accObj;
                }
            }

            // Gets the bounds for the curve legend.
            public Rectangle Bounds
            {   
                get {
                    return new Rectangle(Location, Size);
                }
            }

            // Gets or sets the location for the curve legend.
            public Point Location
            {   
                get {
                    return location;
                }
                set {
                    location = value;
                    chart.Invalidate();

                    // Notifies the chart of the location change. This is used for
                    // the accessibility information. AccessibleEvents.LocationChange
                    // tells the chart the reason for the notification.

                    chart.AccessibilityNotifyClients(AccessibleEvents.LocationChange, 
                        ((CurveLegendAccessibleObject)AccessibilityObject).ID);
                }
            }            

            // Gets or sets the Name for the curve legend.
            public string Name
            {   
                get {
                    return name;
                }
                set {
                    if (name != value) 
                    {
                        name = value;
                        chart.Invalidate();

                        // Notifies the chart of the name change. This is used for
                        // the accessibility information. AccessibleEvents.NameChange
                        // tells the chart the reason for the notification.

                        chart.AccessibilityNotifyClients(AccessibleEvents.NameChange, 
                            ((CurveLegendAccessibleObject)AccessibilityObject).ID);
                    }
                }
            }

            // Gets or sets the Selected state for the curve legend.
            public bool Selected
            {   
                get {
                    return selected;
                }
                set {
                    if (selected != value) 
                    {
                        selected = value;
                        chart.Invalidate();

                        // Notifies the chart of the selection value change. This is used for
                        // the accessibility information. The AccessibleEvents value depends upon
                        // if the selection is true (AccessibleEvents.SelectionAdd) or 
                        // false (AccessibleEvents.SelectionRemove).
                        chart.AccessibilityNotifyClients(
                            selected ? AccessibleEvents.SelectionAdd : AccessibleEvents.SelectionRemove, 
                            ((CurveLegendAccessibleObject)AccessibilityObject).ID);
                    }
                }
            }

            // Gets the Size for the curve legend.
            public Size Size
            {   
                get {                    
                    int legendHeight = chart.Font.Height + 4;
                    Graphics g = chart.CreateGraphics();
                    int legendWidth = (int)g.MeasureString(Name, chart.Font).Width + 4;            

                    return new Size(legendWidth, legendHeight);
                }
            }

            // 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);
                }
            }
        }
    }
}


.NET Framework

サポート対象: 4、3.5、3.0、2.0、1.1、1.0

.NET Framework Client Profile

サポート対象: 4、3.5 SP1

Windows 7, Windows Vista SP1 以降, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core はサポート対象外), Windows Server 2008 R2 (SP1 以降で Server Core をサポート), Windows Server 2003 SP2

.NET Framework では、各プラットフォームのすべてのバージョンはサポートしていません。 サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
この型のすべてのパブリック static (Visual Basic では Shared) メンバーは、スレッド セーフです。 インスタンス メンバーの場合は、スレッド セーフであるとは限りません。
この情報は役に立ちましたか。
(残り 1500 文字)
コミュニティ コンテンツ 追加
注釈 FAQ