Il presente articolo è stato tradotto automaticamente. Passare il puntatore sulle frasi nell'articolo per visualizzare il testo originale. Ulteriori informazioni.
Traduzione
Originale
Questo argomento non è stato ancora valutato - Valuta questo argomento

Classe AccessibleObject

Vengono fornite informazioni che le applicazioni di accessibilità per adattare l'interfaccia utente di (UI) un'applicazione per gli utenti diversamente abili.

Spazio dei nomi:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)
[ComVisibleAttribute(true)]
public class AccessibleObject : StandardOleMarshalObject, 
	IReflect, IAccessible

Il tipo AccessibleObject espone i seguenti membri.

  NomeDescrizione
Metodo pubblicoAccessibleObjectInizializza una nuova istanza di AccessibleObject classe.
In alto
  NomeDescrizione
Proprietà pubblicaBoundsOttiene la posizione e la dimensione dell'oggetto accessibile.
Proprietà pubblicaDefaultActionOttiene una stringa che descrive l'azione predefinita dell'oggetto. non tutti gli oggetti hanno un'azione predefinita.
Proprietà pubblicaDescriptionOttiene una stringa che descrive l'aspetto visivo dell'oggetto specificato. non tutti gli oggetti hanno una descrizione.
Proprietà pubblicaHelpOttiene una descrizione di cui l'oggetto dispone o dell'oggetto viene utilizzato.
Proprietà pubblicaKeyboardShortcutottiene il tasto di scelta rapida o il tasto di scelta per l'oggetto accessibile.
Proprietà pubblicaNameOttiene o imposta il nome dell'oggetto.
Proprietà pubblicaParentOttiene l'elemento padre di un oggetto accessibile.
Proprietà pubblicaRoleottiene il ruolo di questo oggetto accessibile.
Proprietà pubblicaStateOttiene lo stato dell'oggetto accessibile.
Proprietà pubblicaValueOttiene o imposta il valore di un oggetto accessibile.
In alto
  NomeDescrizione
Metodo pubblicoCreateObjRefCrea un oggetto che contiene tutte le informazioni rilevanti obbligatorio per generare un proxy utilizzato per comunicare con un oggetto remoto. (Ereditato da MarshalByRefObject)
Metodo pubblicoDoDefaultActionEseguire l'azione predefinita associata a questo oggetto accessibile.
Metodo pubblicoEquals(Object) Determina se l'oggetto specificato è uguale all'oggetto corrente. (Ereditato da Object)
Metodo protettoFinalize Consente a un oggetto di provare a liberare risorse ed eseguire altre operazioni di pulizia prima che l'oggetto stesso venga reclamato dalla procedura di Garbage Collection. (Ereditato da Object)
Metodo pubblicoGetChildRecupera la corrispondenza figlio accessibile all'indice specificato.
Metodo pubblicoGetChildCountRecupera il numero di elementi figlio che appartengono a un oggetto accessibile.
Metodo pubblicoGetFocusedRecupera l'oggetto che ha lo stato attivo della tastiera.
Metodo pubblicoGetHashCodeFunge da funzione hash per un determinato tipo. (Ereditato da Object)
Metodo pubblicoGetHelpTopicOttiene un identificatore per un identificatore di argomento della Guida e il percorso del file della Guida associato all'oggetto accessibile.
Metodo pubblicoGetLifetimeServiceRecupera l'oggetto corrente del servizio di durata che controlla i criteri di durata dell'istanza. (Ereditato da MarshalByRefObject)
Metodo pubblicoGetSelectedrecupera il figlio attualmente selezionato.
Metodo pubblicoGetTypeOttiene l'oggetto Type dell'istanza corrente. (Ereditato da Object)
Metodo pubblicoHitTestRecupera l'oggetto figlio alle coordinate dello schermo specificate.
Metodo pubblicoInitializeLifetimeServiceOttiene un oggetto di servizio di durata per controllare i criteri di durata dell'istanza. (Ereditato da MarshalByRefObject)
Metodo protettoMemberwiseClone()Consente di creare una copia dei riferimenti dell'oggetto Object corrente. (Ereditato da Object)
Metodo protettoMemberwiseClone(Boolean)Crea una copia superficiale corrente MarshalByRefObject oggetto. (Ereditato da MarshalByRefObject)
Metodo pubblicoNavigateConsente di passare a un altro oggetto accessibile.
Metodo pubblicoSelectModifica la selezione o sposta lo stato attivo dell'oggetto accessibile.
Metodo pubblicoToString Restituisce una stringa che rappresenta l'oggetto corrente. (Ereditato da Object)
Metodo protettoUseStdAccessibleObjects(IntPtr)Infrastruttura. Associa un oggetto a un'istanza di un oggetto AccessibleObject sulla base di un oggetto.
Metodo protettoUseStdAccessibleObjects(IntPtr, Int32)Infrastruttura. Associa un oggetto a un'istanza di un oggetto AccessibleObject sulla base di handle e l'id dell'oggetto dell'oggetto.
In alto
  NomeDescrizione
Implementazione esplicita dell'interfacciaProprietà privataIAccessible.accChildCountInfrastruttura. Ottiene il numero di interfacce figlio che appartengono a questo oggetto. Per una descrizione del membro, vedere IAccessible.accChildCount.
Implementazione esplicita dell'interfacciaMetodo privatoIAccessible.accDoDefaultActionInfrastruttura. Eseguire l'azione predefinita dell'oggetto specificato. non tutti gli oggetti hanno un'azione predefinita. Per una descrizione del membro, vedere IAccessible.accDoDefaultAction.
Implementazione esplicita dell'interfacciaProprietà privataIAccessible.accFocusInfrastruttura. Ottiene l'oggetto che ha lo stato attivo della tastiera. Per una descrizione del membro, vedere IAccessible.accFocus.
Implementazione esplicita dell'interfacciaMetodo privatoIAccessible.accHitTestInfrastruttura. Ottiene l'oggetto figlio alle coordinate dello schermo specificate. Per una descrizione del membro, vedere IAccessible.accHitTest.
Implementazione esplicita dell'interfacciaMetodo privatoIAccessible.accLocationInfrastruttura. Ottiene la posizione corrente dello schermo dell'oggetto. Per una descrizione del membro, vedere IAccessible.accLocation.
Implementazione esplicita dell'interfacciaMetodo privatoIAccessible.accNavigateInfrastruttura. Consente di passare a un oggetto accessibile relativo all'oggetto corrente. Per una descrizione del membro, vedere IAccessible.accNavigate.
Implementazione esplicita dell'interfacciaProprietà privataIAccessible.accParentInfrastruttura. ottiene l'oggetto accessibile padre di questo oggetto. Per una descrizione del membro, vedere IAccessible.accParent.
Implementazione esplicita dell'interfacciaMetodo privatoIAccessible.accSelectInfrastruttura. Modifica la selezione o sposta lo stato attivo dell'oggetto accessibile. Per una descrizione del membro, vedere IAccessible.accSelect.
Implementazione esplicita dell'interfacciaProprietà privataIAccessible.accSelectionInfrastruttura. Ottiene gli oggetti figlio selezionati di un oggetto accessibile. Per una descrizione del membro, vedere IAccessible.accSelection.
Implementazione esplicita dell'interfacciaMetodo privatoIReflect.GetFieldInfrastruttura. ottiene System.Reflection.FieldInfo oggetto che corrisponde al campo e il flag di associazione specificati. Per una descrizione del membro, vedere IReflect.GetField.
Implementazione esplicita dell'interfacciaMetodo privatoIReflect.GetFieldsInfrastruttura. ottiene una matrice di System.Reflection.FieldInfo oggetti che corrispondono a tutti i campi della classe corrente. Per una descrizione del membro, vedere IReflect.GetFields.
Implementazione esplicita dell'interfacciaMetodo privatoIReflect.GetMemberInfrastruttura. ottiene una matrice di System.Reflection.MemberInfo oggetti che corrispondono a tutti i membri pubblici o a tutti i membri che corrispondono a un nome specificato. Per una descrizione del membro, vedere IReflect.GetMember.
Implementazione esplicita dell'interfacciaMetodo privatoIReflect.GetMembersInfrastruttura. ottiene una matrice di System.Reflection.MemberInfo oggetti che corrispondono a tutti i membri pubblici o a tutti i membri della classe corrente. Per una descrizione del membro, vedere IReflect.GetMembers.
Implementazione esplicita dell'interfacciaMetodo privatoIReflect.GetMethod(String, BindingFlags)Infrastruttura. Ottiene un oggetto System.Reflection.MethodInfo oggetto che corrisponde a un metodo specificato con i vincoli di ricerca specificati. Per una descrizione del membro, vedere IReflect.GetMethod.
Implementazione esplicita dell'interfacciaMetodo privatoIReflect.GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[])Infrastruttura. Ottiene un oggetto System.Reflection.MethodInfo oggetto che corrisponde a un metodo specificato, utilizzando una matrice di tipi da scegliere tra i metodi di overload. Per una descrizione del membro, vedere IReflect.GetMethod.
Implementazione esplicita dell'interfacciaMetodo privatoIReflect.GetMethodsInfrastruttura. ottiene una matrice di System.Reflection.MethodInfo oggetti con tutti i metodi pubblici o tutti i metodi della classe corrente. Per una descrizione del membro, vedere IReflect.GetMethods.
Implementazione esplicita dell'interfacciaMetodo privatoIReflect.GetPropertiesInfrastruttura. ottiene una matrice di System.Reflection.PropertyInfo oggetti che corrispondono a tutte le proprietà pubbliche o a tutte le proprietà della classe corrente. Per una descrizione del membro, vedere IReflect.GetProperties.
Implementazione esplicita dell'interfacciaMetodo privatoIReflect.GetProperty(String, BindingFlags)Infrastruttura. Ottiene un oggetto System.Reflection.PropertyInfo oggetto che corrisponde a una proprietà specificata in base ai vincoli di ricerca specificati. Per una descrizione del membro, vedere IReflect.GetProperty.
Implementazione esplicita dell'interfacciaMetodo privatoIReflect.GetProperty(String, BindingFlags, Binder, Type, Type[], ParameterModifier[])Infrastruttura. Ottiene un oggetto System.Reflection.PropertyInfo oggetto che corrisponde a una proprietà specificata ai vincoli di ricerca specificati. Per una descrizione del membro, vedere IReflect.GetProperty.
Implementazione esplicita dell'interfacciaMetodo privatoIReflect.InvokeMemberInfrastruttura. richiama un membro specificato. Per una descrizione del membro, vedere IReflect.InvokeMember.
Implementazione esplicita dell'interfacciaProprietà privataIReflect.UnderlyingSystemTypeInfrastruttura. ottiene il tipo sottostante che rappresenta IReflect oggetto. Per una descrizione del membro, vedere IReflect.UnderlyingSystemType.
In alto

Le applicazioni di accessibilità possono regolare le funzionalità dell'applicazione migliorare l'utilizzabilità per gli utenti con particolari esigenze.

Per gli utenti con problemi di vista, è possibile regolare le funzionalità del sistema operativo e del software per essere conformi alle necessità. Ad esempio, è possibile ingrandire il testo e le immagini ed eseguirne il rendering con un contrasto. Inoltre, è possibile adattare il daltonismo con l'utilizzo appropriato di colori. Per gli utenti che sono notevolmente vedenti, i computer sono accessibili tramite gli strumenti che traducono sintesi vocale sullo schermo o un flusso, refreshable, visualizzazione di revisione dello schermo di Braille.

Per gli utenti uditiva ridotta, è possibile progettare programmi che utilizzano segnali visivi, ad esempio una barra degli strumenti lampeggiante; oppure è possibile visualizzare i messaggi parlati come testo. Ad esempio, una volta attivata, SoundSentry la funzionalità, un'opzione di accessibilità nel Pannello di controllo, fornisce un avviso visivo ogni volta che il sistema esegue un segnale emettere un suono.

Per gli utenti con particolari esigenze di movimento, è possibile progettare controlli che raffinano o eliminano l'utilizzo di tastiera e mouse, quindi miglioranti l'accessibilità del computer. Il Pannello di controllo offre servizi. Ad esempio, è possibile utilizzare il il tastierino numerico del mouse per la navigazione. un'altra opzione, chiamata StickyKeysinoltre, consente agli utenti che non possono gestire due o più percorsi alla volta (come CTRL+P) ottenere lo stesso risultato digitando una chiave per volta.

Per gli utenti con particolari esigenze di linguaggio e conoscitive, è possibile progettare programmi software per soddisfare meglio le loro esigenze. Ad esempio, l'utilizzo dell'ordinamento cospicuo o il proxy, le visualizzazioni semplici, meno parole e un livello di lettura indirizzato agli standard di una scuola elementare possono avvantaggiare gli utenti.

Per gli utenti con i disordini di sequestro, è possibile progettare programmi software per eliminare i modelli di provocazione di sequestro.

Per ulteriori informazioni sull'accessibilità, incluse informazioni sulle applicazioni di accessibilità, vedere la documentazione per l'Accesso facilitato Microsoft in MSDN library o al sito Web Microsoft.

NotaNota

Per utilizzare AccessibleObject, è necessario aggiungere un riferimento a Accessibility assembly installato con .NET Framework. Accessibilità attiva 2,0 di Windows Form supporta solo.

Note per gli eredi

Quando si eredita dalla classe, è possibile eseguire l'override dei membri.

Nell'esempio di codice seguente viene illustrata la creazione di un controllo accessibilità-informato del grafico, utilizzando il AccessibleObject e Control.ControlAccessibleObject classi per esporre informazioni accessibili. I campi controversi due curve con una legenda. ChartControlAccessibleObject classe, che deriva da ControlAccessibleObject, viene utilizzato in CreateAccessibilityInstance metodo per fornire personalizzato informazioni accessibili per il controllo del grafico. Poiché la legenda del grafico non è un reale Control il controllo basato, ma viene tracciato dal controllo del grafico, non ha alcuna informazione accessibile incorporata. Per questo motivo, ChartControlAccessibleObject la classe esegue l'override GetChild metodo restituisca CurveLegendAccessibleObject che rappresenta le informazioni accessibili per ogni parte della legenda. Quando un'applicazione accessibile-informata utilizza il controllo, il controllo può fornire informazioni accessibili necessarie.


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

Supportato in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supportato in: 4, 3.5 SP1

Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (ruoli di base del server non supportati), Windows Server 2008 R2 (ruoli di base del server supportati con SP1 o versione successiva, Itanium non supportato)

.NET Framework non supporta tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.
Qualsiasi membro static (Shared in Visual Basic) pubblico di questo tipo è thread-safe. I membri di istanza non sono garantiti come thread-safe.
Il documento è risultato utile?
(1500 caratteri rimanenti)

Aggiunte alla community

AGGIUNGI
© 2013 Microsoft. Tutti i diritti riservati.