This topic has not yet been rated - Rate this topic

SystemInformation Class

Provides information about the current system environment.

System.Object
  System.Windows.Forms.SystemInformation

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)
public class SystemInformation

The SystemInformation type exposes the following members.

  Name Description
Public property Static member ActiveWindowTrackingDelay Gets the active window tracking delay.
Public property Static member ArrangeDirection Gets a value that indicates the direction in which the operating system arranges minimized windows.
Public property Static member ArrangeStartingPosition Gets an ArrangeStartingPosition value that indicates the starting position from which the operating system arranges minimized windows.
Public property Static member BootMode Gets a BootMode value that indicates the boot mode the system was started in.
Public property Static member Border3DSize Gets the thickness, in pixels, of a three-dimensional (3-D) style window or system control border.
Public property Static member BorderMultiplierFactor Gets the border multiplier factor that is used when determining the thickness of a window's sizing border.
Public property Static member BorderSize Gets the thickness, in pixels, of a flat-style window or system control border.
Public property Static member CaptionButtonSize Gets the standard size, in pixels, of a button in a window's title bar.
Public property Static member CaptionHeight Gets the height, in pixels, of the standard title bar area of a window.
Public property Static member CaretBlinkTime Gets the caret blink time.
Public property Static member CaretWidth Gets the width, in pixels, of the caret in edit controls.
Public property Static member ComputerName Gets the NetBIOS computer name of the local computer.
Public property Static member CursorSize Gets the maximum size, in pixels, that a cursor can occupy.
Public property Static member DbcsEnabled Gets a value indicating whether the operating system is capable of handling double-byte character set (DBCS) characters.
Public property Static member DebugOS Gets a value indicating whether the debug version of USER.EXE is installed.
Public property Static member DoubleClickSize Gets the dimensions, in pixels, of the area within which the user must click twice for the operating system to consider the two clicks a double-click.
Public property Static member DoubleClickTime Gets the maximum number of milliseconds that can elapse between a first click and a second click for the OS to consider the mouse action a double-click.
Public property Static member DragFullWindows Gets a value indicating whether the user has enabled full window drag.
Public property Static member DragSize Gets the width and height of a rectangle centered on the point the mouse button was pressed, within which a drag operation will not begin.
Public property Static member FixedFrameBorderSize Gets the thickness, in pixels, of the frame border of a window that has a caption and is not resizable.
Public property Static member FontSmoothingContrast Gets the font smoothing contrast value used in ClearType smoothing.
Public property Static member FontSmoothingType Gets the current type of font smoothing.
Public property Static member FrameBorderSize Gets the thickness, in pixels, of the resizing border that is drawn around the perimeter of a window that is being drag resized.
Public property Static member HighContrast Gets a value indicating whether the user has enabled the high-contrast mode accessibility feature.
Public property Static member HorizontalFocusThickness Gets the thickness of the left and right edges of the system focus rectangle, in pixels.
Public property Static member HorizontalResizeBorderThickness Gets the thickness of the left and right edges of the sizing border around the perimeter of a window being resized, in pixels.
Public property Static member HorizontalScrollBarArrowWidth Gets the width, in pixels, of the arrow bitmap on the horizontal scroll bar.
Public property Static member HorizontalScrollBarHeight Gets the default height, in pixels, of the horizontal scroll bar.
Public property Static member HorizontalScrollBarThumbWidth Gets the width, in pixels, of the scroll box in a horizontal scroll bar.
Public property Static member IconHorizontalSpacing Gets the width, in pixels, of an icon arrangement cell in large icon view.
Public property Static member IconSize Gets the dimensions, in pixels, of the Windows default program icon size.
Public property Static member IconSpacingSize Gets the size, in pixels, of the grid square used to arrange icons in a large-icon view.
Public property Static member IconVerticalSpacing Gets the height, in pixels, of an icon arrangement cell in large icon view.
Public property Static member IsActiveWindowTrackingEnabled Gets a value indicating whether active window tracking is enabled.
Public property Static member IsComboBoxAnimationEnabled Gets a value indicating whether the slide-open effect for combo boxes is enabled.
Public property Static member IsDropShadowEnabled Gets a value indicating whether the drop shadow effect is enabled.
Public property Static member IsFlatMenuEnabled Gets a value indicating whether native user menus have a flat menu appearance.
Public property Static member IsFontSmoothingEnabled Gets a value indicating whether font smoothing is enabled.
Public property Static member IsHotTrackingEnabled Gets a value indicating whether hot tracking of user-interface elements, such as menu names on menu bars, is enabled.
Public property Static member IsIconTitleWrappingEnabled Gets a value indicating whether icon-title wrapping is enabled.
Public property Static member IsKeyboardPreferred Gets a value indicating whether the user relies on the keyboard instead of the mouse, and prefers applications to display keyboard interfaces that would otherwise be hidden.
Public property Static member IsListBoxSmoothScrollingEnabled Gets a value indicating whether the smooth-scrolling effect for list boxes is enabled.
Public property Static member IsMenuAnimationEnabled Gets a value indicating whether menu fade or slide animation features are enabled.
Public property Static member IsMenuFadeEnabled Gets a value indicating whether menu fade animation is enabled.
Public property Static member IsMinimizeRestoreAnimationEnabled Gets a value indicating whether window minimize and restore animation is enabled.
Public property Static member IsSelectionFadeEnabled Gets a value indicating whether the selection fade effect is enabled.
Public property Static member IsSnapToDefaultEnabled Gets a value indicating whether the snap-to-default-button feature is enabled.
Public property Static member IsTitleBarGradientEnabled Gets a value indicating whether the gradient effect for window title bars is enabled.
Public property Static member IsToolTipAnimationEnabled Gets a value indicating whether ToolTip animation is enabled.
Public property Static member KanjiWindowHeight Gets the height, in pixels, of the Kanji window at the bottom of the screen for double-byte character set (DBCS) versions of Windows.
Public property Static member KeyboardDelay Gets the keyboard repeat-delay setting.
Public property Static member KeyboardSpeed Gets the keyboard repeat-speed setting.
Public property Static member MaxWindowTrackSize Gets the default maximum dimensions, in pixels, of a window that has a caption and sizing borders.
Public property Static member MenuAccessKeysUnderlined Gets a value indicating whether menu access keys are always underlined.
Public property Static member MenuBarButtonSize Gets the default width, in pixels, for menu-bar buttons and the height, in pixels, of a menu bar.
Public property Static member MenuButtonSize Gets the default dimensions, in pixels, of menu-bar buttons.
Public property Static member MenuCheckSize Gets the dimensions, in pixels, of the default size of a menu check mark area.
Public property Static member MenuFont Gets the font used to display text on menus.
Public property Static member MenuHeight Gets the height, in pixels, of one line of a menu.
Public property Static member MenuShowDelay Gets the time, in milliseconds, that the system waits before displaying a cascaded shortcut menu when the mouse cursor is over a submenu item.
Public property Static member MidEastEnabled Gets a value indicating whether the operating system is enabled for the Hebrew and Arabic languages.
Public property Static member MinimizedWindowSize Gets the dimensions, in pixels, of a normal minimized window.
Public property Static member MinimizedWindowSpacingSize Gets the dimensions, in pixels, of the area each minimized window is allocated when arranged.
Public property Static member MinimumWindowSize Gets the minimum width and height for a window, in pixels.
Public property Static member MinWindowTrackSize Gets the default minimum dimensions, in pixels, that a window may occupy during a drag resize.
Public property Static member MonitorCount Gets the number of display monitors on the desktop.
Public property Static member MonitorsSameDisplayFormat Gets a value indicating whether all the display monitors are using the same pixel color format.
Public property Static member MouseButtons Gets the number of buttons on the mouse.
Public property Static member MouseButtonsSwapped Gets a value indicating whether the functions of the left and right mouse buttons have been swapped.
Public property Static member MouseHoverSize Gets the dimensions, in pixels, of the rectangle within which the mouse pointer has to stay for the mouse hover time before a mouse hover message is generated.
Public property Static member MouseHoverTime Gets the time, in milliseconds, that the mouse pointer has to stay in the hover rectangle before a mouse hover message is generated.
Public property Static member MousePresent Gets a value indicating whether a pointing device is installed.
Public property Static member MouseSpeed Gets the current mouse speed.
Public property Static member MouseWheelPresent Gets a value indicating whether a mouse with a mouse wheel is installed.
Public property Static member MouseWheelScrollDelta Gets the amount of the delta value of a single mouse wheel rotation increment.
Public property Static member MouseWheelScrollLines Gets the number of lines to scroll when the mouse wheel is rotated.
Public property Static member NativeMouseWheelSupport Gets a value indicating whether the operating system natively supports a mouse wheel.
Public property Static member Network Gets a value indicating whether a network connection is present.
Public property Static member PenWindows Gets a value indicating whether the Microsoft Windows for Pen Computing extensions are installed.
Public property Static member PopupMenuAlignment Gets the side of pop-up menus that are aligned to the corresponding menu-bar item.
Public property Static member PowerStatus Gets the current system power status.
Public property Static member PrimaryMonitorMaximizedWindowSize Gets the default dimensions, in pixels, of a maximized window on the primary display.
Public property Static member PrimaryMonitorSize Gets the dimensions, in pixels, of the current video mode of the primary display.
Public property Static member RightAlignedMenus Gets a value indicating whether drop-down menus are right-aligned with the corresponding menu-bar item.
Public property Static member ScreenOrientation Gets the orientation of the screen.
Public property Static member Secure Gets a value indicating whether a Security Manager is present on this operating system.
Public property Static member ShowSounds Gets a value indicating whether the user prefers that an application present information in visual form in situations when it would present the information in audible form.
Public property Static member SizingBorderWidth Gets the width, in pixels, of the sizing border drawn around the perimeter of a window being resized.
Public property Static member SmallCaptionButtonSize Gets the width, in pixels, of small caption buttons, and the height, in pixels, of small captions.
Public property Static member SmallIconSize Gets the dimensions, in pixels, of a small icon.
Public property Static member TerminalServerSession Gets a value indicating whether the calling process is associated with a Terminal Services client session.
Public property Static member ToolWindowCaptionButtonSize Gets the dimensions, in pixels, of small caption buttons.
Public property Static member ToolWindowCaptionHeight Gets the height, in pixels, of a tool window caption.
Public property Static member UIEffectsEnabled Gets a value indicating whether user interface (UI) effects are enabled or disabled.
Public property Static member UserDomainName Gets the name of the domain the user belongs to.
Public property Static member UserInteractive Gets a value indicating whether the current process is running in user-interactive mode.
Public property Static member UserName Gets the user name associated with the current thread.
Public property Static member VerticalFocusThickness Gets the thickness, in pixels, of the top and bottom edges of the system focus rectangle.
Public property Static member VerticalResizeBorderThickness Gets the thickness, in pixels, of the top and bottom edges of the sizing border around the perimeter of a window being resized.
Public property Static member VerticalScrollBarArrowHeight Gets the height, in pixels, of the arrow bitmap on the vertical scroll bar.
Public property Static member VerticalScrollBarThumbHeight Gets the height, in pixels, of the scroll box in a vertical scroll bar.
Public property Static member VerticalScrollBarWidth Gets the default width, in pixels, of the vertical scroll bar.
Public property Static member VirtualScreen Gets the bounds of the virtual screen.
Public property Static member WorkingArea Gets the size, in pixels, of the working area of the screen.
Top
  Name Description
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Top

The SystemInformation class provides static properties that can be used to get information about the current system environment. The class provides access to information such as Windows display element sizes, operating system settings, network availability, and the capabilities of hardware installed on the system. This class cannot be instantiated.

For more information about system-wide parameters, see "SystemParametersInfo" in the Platform SDK documentation at .

The following code example lists all properties of the SystemInformation class in a ListBox and displays the current value of the property in a TextBox when a list item selected.


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


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ