Esporta (0) Stampa
Espandi tutto
Espandi Riduci a icona
Questo argomento non è stato ancora valutato - Valuta questo argomento

Proprietà SystemInformation.IsTitleBarGradientEnabled

Ottiene un valore che indica se l'effetto di sfumatura per le barre del titolo delle finestre è attivato.

Spazio dei nomi: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public static bool IsTitleBarGradientEnabled { get; }
/** @property */
public static boolean get_IsTitleBarGradientEnabled ()

public static function get IsTitleBarGradientEnabled () : boolean

Non applicabile.

Valore proprietà

true se l'effetto di sfumatura per le barre del titolo delle finestre è attivato; in caso contrario, false.

La proprietà IsTitleBarGradientEnabled indica se lo sfondo delle barre del titolo delle finestra è disegnato utilizzando un effetto di riempimento sfumato.

NotaNota:

Questa proprietà è supportata esclusivamente in Windows 98, Windows Millennium Edition, Windows 2000, Windows XP e Windows Server 2003.

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

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

package SystemInfoBrowser;

import System.*;
import System.Collections.*;
import System.ComponentModel.*;
import System.Drawing.*;
import System.Reflection.*;
import System.Windows.Forms.*;

public class SystemInfoBrowserForm extends 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 = System.Windows.Forms.SystemInformation.class.ToType();
        PropertyInfo pi[] = t.GetProperties();
        for (int i = 0; i < pi.length; i++) {
            listBox1.get_Items().Add(pi[i].get_Name());
        }
        textBox1.set_Text("The SystemInformation class has "
            + ((Int32)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.add_SelectedIndexChanged(
            new EventHandler(listBox1_SelectedIndexChanged));
        this.ResumeLayout(false);
    } //SystemInfoBrowserForm

    private void listBox1_SelectedIndexChanged(Object sender, EventArgs e)
    {
        // Return if no list item is selected.
        if (listBox1.get_SelectedIndex() == -1) {
            return;
        }
        // Get the property name from the list item.
        String propname = listBox1.get_Text();

        if (propname.Equals("PowerStatus")) {
            // Cycle and display the values of each property of the
            // PowerStatus property.
            textBox1.set_Text(textBox1.get_Text()
                + "\r\nThe value of the PowerStatus property is:");
            Type t = System.Windows.Forms.PowerStatus.class.ToType();
            PropertyInfo pi[] = t.GetProperties();
            for (int i = 0; i < pi.length; i++) {
                Object propval = pi[i].GetValue(
                    SystemInformation.get_PowerStatus(), null);
                textBox1.set_Text(textBox1.get_Text()
                    + "\r\n    PowerStatus." + pi[i].get_Name()
                    + " is: " + propval.ToString());
            }
        }
        else {
            // Display the value of the selected property of the
            // SystemInformation type.
            Type t = System.Windows.Forms.SystemInformation.class.ToType();
            PropertyInfo pi[] = t.GetProperties();
            PropertyInfo prop = null;
            for (int i = 0; i < pi.length; i++) {
                if (pi[i].get_Name().Equals(propname)) {
                    prop = pi[i];
                    break;
                }
            }
            Object propval = prop.GetValue(null, null);
            textBox1.set_Text(textBox1.get_Text() + "\r\nThe value of the "
                + propname + " property is: " + propval.ToString());
        }
    } //listBox1_SelectedIndexChanged

    private void InitForm()
    {
        // Initialize the form settings
        this.listBox1 = new System.Windows.Forms.ListBox();
        this.textBox1 = new System.Windows.Forms.TextBox();
        this.listBox1.set_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.set_Location(new System.Drawing.Point(8, 16));
        this.listBox1.set_Size(new System.Drawing.Size(172, 496));
        this.listBox1.set_TabIndex(0);
        this.textBox1.set_Anchor((System.Windows.Forms.AnchorStyles)
            (System.Windows.Forms.AnchorStyles.Top
            | System.Windows.Forms.AnchorStyles.Bottom
            | System.Windows.Forms.AnchorStyles.Right));
        this.textBox1.set_Location(new System.Drawing.Point(188, 16));
        this.textBox1.set_Multiline(true);
        this.textBox1.set_ScrollBars(System.Windows.Forms.ScrollBars.Vertical);
        this.textBox1.set_Size(new System.Drawing.Size(420, 496));
        this.textBox1.set_TabIndex(1);
        this.set_ClientSize(new System.Drawing.Size(616, 525));
        this.get_Controls().Add(this.textBox1);
        this.get_Controls().Add(this.listBox1);
        this.set_Text("Select a SystemInformation property to get the value of");
    } //InitForm

    /** @attribute STAThread()
     */
    public static void main(String[] args)
    {
        Application.Run(new SystemInfoBrowserForm());
    } //main
} //SystemInfoBrowserForm

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile per Pocket PC, Windows Mobile per Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

Microsoft .NET Framework 3.0 è supportato in Windows Vista, Microsoft Windows XP SP2 e Windows Server 2003 SP1.

.NET Framework

Supportato in:
Il documento è risultato utile?
(1500 caratteri rimanenti)
Grazie per i commenti inviati.

Aggiunte alla community

AGGIUNGI
Mostra:
© 2014 Microsoft. Tutti i diritti riservati.