Export (0) Print
Expand All

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.

  NameDescription
Public propertyStatic memberActiveWindowTrackingDelayGets the active window tracking delay.
Public propertyStatic memberArrangeDirectionGets a value that indicates the direction in which the operating system arranges minimized windows.
Public propertyStatic memberArrangeStartingPositionGets an ArrangeStartingPosition value that indicates the starting position from which the operating system arranges minimized windows.
Public propertyStatic memberBootModeGets a BootMode value that indicates the boot mode the system was started in.
Public propertyStatic memberBorder3DSizeGets the thickness, in pixels, of a three-dimensional (3-D) style window or system control border.
Public propertyStatic memberBorderMultiplierFactorGets the border multiplier factor that is used when determining the thickness of a window's sizing border.
Public propertyStatic memberBorderSizeGets the thickness, in pixels, of a flat-style window or system control border.
Public propertyStatic memberCaptionButtonSizeGets the standard size, in pixels, of a button in a window's title bar.
Public propertyStatic memberCaptionHeightGets the height, in pixels, of the standard title bar area of a window.
Public propertyStatic memberCaretBlinkTimeGets the caret blink time.
Public propertyStatic memberCaretWidthGets the width, in pixels, of the caret in edit controls.
Public propertyStatic memberComputerNameGets the NetBIOS computer name of the local computer.
Public propertyStatic memberCursorSizeGets the maximum size, in pixels, that a cursor can occupy.
Public propertyStatic memberDbcsEnabledGets a value indicating whether the operating system is capable of handling double-byte character set (DBCS) characters.
Public propertyStatic memberDebugOSGets a value indicating whether the debug version of USER.EXE is installed.
Public propertyStatic memberDoubleClickSizeGets 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 propertyStatic memberDoubleClickTimeGets 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 propertyStatic memberDragFullWindowsGets a value indicating whether the user has enabled full window drag.
Public propertyStatic memberDragSizeGets 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 propertyStatic memberFixedFrameBorderSizeGets the thickness, in pixels, of the frame border of a window that has a caption and is not resizable.
Public propertyStatic memberFontSmoothingContrastGets the font smoothing contrast value used in ClearType smoothing.
Public propertyStatic memberFontSmoothingTypeGets the current type of font smoothing.
Public propertyStatic memberFrameBorderSizeGets the thickness, in pixels, of the resizing border that is drawn around the perimeter of a window that is being drag resized.
Public propertyStatic memberHighContrastGets a value indicating whether the user has enabled the high-contrast mode accessibility feature.
Public propertyStatic memberHorizontalFocusThicknessGets the thickness of the left and right edges of the system focus rectangle, in pixels.
Public propertyStatic memberHorizontalResizeBorderThicknessGets the thickness of the left and right edges of the sizing border around the perimeter of a window being resized, in pixels.
Public propertyStatic memberHorizontalScrollBarArrowWidthGets the width, in pixels, of the arrow bitmap on the horizontal scroll bar.
Public propertyStatic memberHorizontalScrollBarHeightGets the default height, in pixels, of the horizontal scroll bar.
Public propertyStatic memberHorizontalScrollBarThumbWidthGets the width, in pixels, of the scroll box in a horizontal scroll bar.
Public propertyStatic memberIconHorizontalSpacingGets the width, in pixels, of an icon arrangement cell in large icon view.
Public propertyStatic memberIconSizeGets the dimensions, in pixels, of the Windows default program icon size.
Public propertyStatic memberIconSpacingSizeGets the size, in pixels, of the grid square used to arrange icons in a large-icon view.
Public propertyStatic memberIconVerticalSpacingGets the height, in pixels, of an icon arrangement cell in large icon view.
Public propertyStatic memberIsActiveWindowTrackingEnabledGets a value indicating whether active window tracking is enabled.
Public propertyStatic memberIsComboBoxAnimationEnabledGets a value indicating whether the slide-open effect for combo boxes is enabled.
Public propertyStatic memberIsDropShadowEnabledGets a value indicating whether the drop shadow effect is enabled.
Public propertyStatic memberIsFlatMenuEnabledGets a value indicating whether native user menus have a flat menu appearance.
Public propertyStatic memberIsFontSmoothingEnabledGets a value indicating whether font smoothing is enabled.
Public propertyStatic memberIsHotTrackingEnabledGets a value indicating whether hot tracking of user-interface elements, such as menu names on menu bars, is enabled.
Public propertyStatic memberIsIconTitleWrappingEnabledGets a value indicating whether icon-title wrapping is enabled.
Public propertyStatic memberIsKeyboardPreferredGets 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 propertyStatic memberIsListBoxSmoothScrollingEnabledGets a value indicating whether the smooth-scrolling effect for list boxes is enabled.
Public propertyStatic memberIsMenuAnimationEnabledGets a value indicating whether menu fade or slide animation features are enabled.
Public propertyStatic memberIsMenuFadeEnabledGets a value indicating whether menu fade animation is enabled.
Public propertyStatic memberIsMinimizeRestoreAnimationEnabledGets a value indicating whether window minimize and restore animation is enabled.
Public propertyStatic memberIsSelectionFadeEnabledGets a value indicating whether the selection fade effect is enabled.
Public propertyStatic memberIsSnapToDefaultEnabledGets a value indicating whether the snap-to-default-button feature is enabled.
Public propertyStatic memberIsTitleBarGradientEnabledGets a value indicating whether the gradient effect for window title bars is enabled.
Public propertyStatic memberIsToolTipAnimationEnabledGets a value indicating whether ToolTip animation is enabled.
Public propertyStatic memberKanjiWindowHeightGets the height, in pixels, of the Kanji window at the bottom of the screen for double-byte character set (DBCS) versions of Windows.
Public propertyStatic memberKeyboardDelayGets the keyboard repeat-delay setting.
Public propertyStatic memberKeyboardSpeedGets the keyboard repeat-speed setting.
Public propertyStatic memberMaxWindowTrackSizeGets the default maximum dimensions, in pixels, of a window that has a caption and sizing borders.
Public propertyStatic memberMenuAccessKeysUnderlinedGets a value indicating whether menu access keys are always underlined.
Public propertyStatic memberMenuBarButtonSizeGets the default width, in pixels, for menu-bar buttons and the height, in pixels, of a menu bar.
Public propertyStatic memberMenuButtonSizeGets the default dimensions, in pixels, of menu-bar buttons.
Public propertyStatic memberMenuCheckSizeGets the dimensions, in pixels, of the default size of a menu check mark area.
Public propertyStatic memberMenuFontGets the font used to display text on menus.
Public propertyStatic memberMenuHeightGets the height, in pixels, of one line of a menu.
Public propertyStatic memberMenuShowDelayGets the time, in milliseconds, that the system waits before displaying a cascaded shortcut menu when the mouse cursor is over a submenu item.
Public propertyStatic memberMidEastEnabledGets a value indicating whether the operating system is enabled for the Hebrew and Arabic languages.
Public propertyStatic memberMinimizedWindowSizeGets the dimensions, in pixels, of a normal minimized window.
Public propertyStatic memberMinimizedWindowSpacingSizeGets the dimensions, in pixels, of the area each minimized window is allocated when arranged.
Public propertyStatic memberMinimumWindowSizeGets the minimum width and height for a window, in pixels.
Public propertyStatic memberMinWindowTrackSizeGets the default minimum dimensions, in pixels, that a window may occupy during a drag resize.
Public propertyStatic memberMonitorCountGets the number of display monitors on the desktop.
Public propertyStatic memberMonitorsSameDisplayFormatGets a value indicating whether all the display monitors are using the same pixel color format.
Public propertyStatic memberMouseButtonsGets the number of buttons on the mouse.
Public propertyStatic memberMouseButtonsSwappedGets a value indicating whether the functions of the left and right mouse buttons have been swapped.
Public propertyStatic memberMouseHoverSizeGets 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 propertyStatic memberMouseHoverTimeGets the time, in milliseconds, that the mouse pointer has to stay in the hover rectangle before a mouse hover message is generated.
Public propertyStatic memberMousePresentGets a value indicating whether a pointing device is installed.
Public propertyStatic memberMouseSpeedGets the current mouse speed.
Public propertyStatic memberMouseWheelPresentGets a value indicating whether a mouse with a mouse wheel is installed.
Public propertyStatic memberMouseWheelScrollDeltaGets the amount of the delta value of a single mouse wheel rotation increment.
Public propertyStatic memberMouseWheelScrollLinesGets the number of lines to scroll when the mouse wheel is rotated.
Public propertyStatic memberNativeMouseWheelSupportGets a value indicating whether the operating system natively supports a mouse wheel.
Public propertyStatic memberNetworkGets a value indicating whether a network connection is present.
Public propertyStatic memberPenWindowsGets a value indicating whether the Microsoft Windows for Pen Computing extensions are installed.
Public propertyStatic memberPopupMenuAlignmentGets the side of pop-up menus that are aligned to the corresponding menu-bar item.
Public propertyStatic memberPowerStatusGets the current system power status.
Public propertyStatic memberPrimaryMonitorMaximizedWindowSizeGets the default dimensions, in pixels, of a maximized window on the primary display.
Public propertyStatic memberPrimaryMonitorSizeGets the dimensions, in pixels, of the current video mode of the primary display.
Public propertyStatic memberRightAlignedMenusGets a value indicating whether drop-down menus are right-aligned with the corresponding menu-bar item.
Public propertyStatic memberScreenOrientationGets the orientation of the screen.
Public propertyStatic memberSecureGets a value indicating whether a Security Manager is present on this operating system.
Public propertyStatic memberShowSoundsGets 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 propertyStatic memberSizingBorderWidthGets the width, in pixels, of the sizing border drawn around the perimeter of a window being resized.
Public propertyStatic memberSmallCaptionButtonSizeGets the width, in pixels, of small caption buttons, and the height, in pixels, of small captions.
Public propertyStatic memberSmallIconSizeGets the dimensions, in pixels, of a small icon.
Public propertyStatic memberTerminalServerSessionGets a value indicating whether the calling process is associated with a Terminal Services client session.
Public propertyStatic memberToolWindowCaptionButtonSizeGets the dimensions, in pixels, of small caption buttons.
Public propertyStatic memberToolWindowCaptionHeightGets the height, in pixels, of a tool window caption.
Public propertyStatic memberUIEffectsEnabledGets a value indicating whether user interface (UI) effects are enabled or disabled.
Public propertyStatic memberUserDomainNameGets the name of the domain the user belongs to.
Public propertyStatic memberUserInteractiveGets a value indicating whether the current process is running in user-interactive mode.
Public propertyStatic memberUserNameGets the user name associated with the current thread.
Public propertyStatic memberVerticalFocusThicknessGets the thickness, in pixels, of the top and bottom edges of the system focus rectangle.
Public propertyStatic memberVerticalResizeBorderThicknessGets the thickness, in pixels, of the top and bottom edges of the sizing border around the perimeter of a window being resized.
Public propertyStatic memberVerticalScrollBarArrowHeightGets the height, in pixels, of the arrow bitmap on the vertical scroll bar.
Public propertyStatic memberVerticalScrollBarThumbHeightGets the height, in pixels, of the scroll box in a vertical scroll bar.
Public propertyStatic memberVerticalScrollBarWidthGets the default width, in pixels, of the vertical scroll bar.
Public propertyStatic memberVirtualScreenGets the bounds of the virtual screen.
Public propertyStatic memberWorkingAreaGets the size, in pixels, of the working area of the screen.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns 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.

Community Additions

ADD
Show:
© 2014 Microsoft