SystemInformation.UIEffectsEnabled Proprietà

Definizione

Ottiene un valore che indica se gli effetti dell'interfaccia utente sono abilitati o disabilitati.

C#
public static bool UIEffectsEnabled { get; }

Valore della proprietà

Boolean

true se gli effetti dell'interfaccia utente sono abilitati; in caso contrario, false.

Esempio

Nell'esempio di codice seguente vengono elencate tutte le proprietà della SystemInformation classe in un e viene visualizzato il valore corrente della proprietà in un ListBox TextBox elemento di elenco selezionato.

C#
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Reflection;
using System.Windows.Forms;

namespace SystemInfoBrowser
{
    public class SystemInfoBrowserForm : System.Windows.Forms.Form
    {
        private System.Windows.Forms.ListBox listBox1;
        private System.Windows.Forms.TextBox textBox1;        
        
        public SystemInfoBrowserForm()
        {
            this.SuspendLayout();
            InitForm();
            
            // Add each property of the SystemInformation class to the list box.
            Type t = typeof(System.Windows.Forms.SystemInformation);            
            PropertyInfo[] pi = t.GetProperties();            
            for( int i=0; i<pi.Length; i++ )
                listBox1.Items.Add( pi[i].Name );            
            textBox1.Text = "The SystemInformation class has "+pi.Length.ToString()+" properties.\r\n";

            // Configure the list item selected handler for the list box to invoke a 
            // method that displays the value of each property.
            listBox1.SelectedIndexChanged += new EventHandler(listBox1_SelectedIndexChanged);
            this.ResumeLayout(false);
        }
        
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            // Return if no list item is selected.
            if( listBox1.SelectedIndex == -1 ) return;
            // Get the property name from the list item.
            string propname = listBox1.Text;
            
            if( propname == "PowerStatus" )
            {
                // Cycle and display the values of each property of the PowerStatus property.
                textBox1.Text += "\r\nThe value of the PowerStatus property is:";                                
                Type t = typeof(System.Windows.Forms.PowerStatus);
                PropertyInfo[] pi = t.GetProperties();            
                for( int i=0; i<pi.Length; i++ )
                {
                    object propval = pi[i].GetValue(SystemInformation.PowerStatus, null);            
                    textBox1.Text += "\r\n    PowerStatus."+pi[i].Name+" is: "+propval.ToString();
                }
            }
            else
            {
                // Display the value of the selected property of the SystemInformation type.
                Type t = typeof(System.Windows.Forms.SystemInformation);
                PropertyInfo[] pi = t.GetProperties();            
                PropertyInfo prop = null;
                for( int i=0; i<pi.Length; i++ )
                    if( pi[i].Name == propname )
                    {
                        prop = pi[i];
                        break;           
                    }
                object propval = prop.GetValue(null, null);            
                textBox1.Text += "\r\nThe value of the "+propname+" property is: "+propval.ToString();
            }
        }

        private void InitForm()
        {
            // Initialize the form settings
            this.listBox1 = new System.Windows.Forms.ListBox();
            this.textBox1 = new System.Windows.Forms.TextBox();            
            this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
                | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)));
            this.listBox1.Location = new System.Drawing.Point(8, 16);
            this.listBox1.Size = new System.Drawing.Size(172, 496);
            this.listBox1.TabIndex = 0;            
            this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
                | System.Windows.Forms.AnchorStyles.Right)));
            this.textBox1.Location = new System.Drawing.Point(188, 16);
            this.textBox1.Multiline = true;
            this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;           
            this.textBox1.Size = new System.Drawing.Size(420, 496);
            this.textBox1.TabIndex = 1;            
            this.ClientSize = new System.Drawing.Size(616, 525);            
            this.Controls.Add(this.textBox1);
            this.Controls.Add(this.listBox1);            
            this.Text = "Select a SystemInformation property to get the value of";                   
        }

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

Commenti

Gli effetti dell'interfaccia utente includono animazioni, sbiadimento, rilevamento frequente e scorrimento uniforme dei controlli di sistema e disegno di un'ombreggiatura sotto il cursore del mouse. Quando gli effetti dell'interfaccia utente sono disabilitati, queste funzionalità sono disabilitate. Quando gli effetti dell'interfaccia utente sono abilitati, vengono abilitati solo gli effetti configurati come attivi per l'utente corrente.

La tabella seguente elenca le proprietà che indicano se sono abilitati specifici effetti dell'interfaccia utente, se il valore di questa proprietà è true:

Elemento Descrizione
IsComboBoxAnimationEnabled Indica se l'effetto diapositiva aperto per le caselle combinate è abilitato.
IsTitleBarGradientEnabled Indica se l'effetto sfumatura per le barre del titolo della finestra è abilitato.
IsHotTrackingEnabled Indica se il rilevamento frequente degli elementi dell'interfaccia utente, ad esempio i nomi dei menu nelle barre dei menu, è abilitato.
IsListBoxSmoothScrollingEnabled Indica se l'effetto di scorrimento uniforme per le caselle di riepilogo è abilitato.
IsMenuAnimationEnabled Indica se le funzionalità di animazione di menu o diapositiva sono abilitate.
MenuAccessKeysUnderlined Indica se le chiavi di accesso ai menu sono sempre sottolineate.
IsSelectionFadeEnabled Indica se l'effetto di dissolvenza della selezione è abilitato.
IsToolTipAnimationEnabled Indica se l'animazione della descrizione comando è abilitata.

Si applica a

Prodotto Versioni
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
Windows Desktop 3.0, 3.1, 5, 6, 7

Vedi anche