System metric or configuration setting to retrieve. This parameter can be one of the following values. Note that all SM_CX* values are widths and all SM_CY* values are heights. Also note that all settings designed to return Boolean data represent TRUE as any nonzero value, and FALSE as a zero value.
The C# and VB Definition of the SystemMetric enum can be found here:
* System metrics may vary from display to display. Most values are returned in number of pixels, all others are flag or boolean values.
* GetSystemMetrics(SM_CMONITORS) counts only display monitors. This is different from EnumDisplayMonitors, which enumerates display monitors and also non-display pseudo-monitors.
The SM_ARRANGE setting specifies how the system arranges minimized windows, and consists of a starting position and a direction. The starting position can be one of the following values.
Start at the lower-left corner of the screen (default position).
Start at the lower-right corner of the screen. Equivalent to ARW_STARTRIGHT.
Hide minimized windows by moving them off the visible area of the screen.
Start at the upper-left corner of the screen. Equivalent to ARV_STARTTOP.
Start at the upper-right corner of the screen. Equivalent to ARW_STARTTOP | SRW_STARTRIGHT.
The direction in which to arrange can be one of the following values.
Arrange vertically, top to bottom.
Arrange horizontally, left to right.
Arrange horizontally, right to left.
Arrange vertically, bottom to top.
Tips & Tricks:
Use the Form.ClientSize method to get the size of the working area of the window, which is much easier than calculating the system
metrics yourself to get the same result (something that you could do if you had to, and had to do back in the day):
Sample Code C#:
The following example creates a new ListView control, and displays each member of the enumerator and it's return value. To use this example, paste it into the code (not the deigner code) file of a blank form. (ie, Form1.cs), if you have AIPCC installed you wont need to use the WindowsAPI class, instead it will be imported fron the AIP class library.
public partial class Form1:Form
public partial class WindowsAPI
// *** PASTE SYSTEMMETRIC ENUM HERE ***
public static extern int GetSystemMetrics(SystemMetric smIndex);