getdevicecaps (gdi32)
Last changed: -93.92.200.212

.
Summary

C# Signature:

[DllImport("gdi32.dll")]
static extern int GetDeviceCaps(IntPtr hdc, int nIndex);

VB.NET Signature:

<DllImport("gdi32.dll")> _
Public Shared Function GetDeviceCaps(ByVal hDC As IntPtr, ByVal nIndex As Integer) As Integer
End Function

User-Defined Types:

You can use the following enumeration for passing in as nIndex:

  public enum DeviceCap
  {
      DRIVERVERSION = 0,
      TECHNOLOGY    = 2,
      HORZSIZE      = 4,
      VERTSIZE      = 6,
      HORZRES       = 8,
      VERTRES       = 10,
      BITSPIXEL     = 12,
      PLANES    = 14,
      NUMBRUSHES    = 16,
      NUMPENS       = 18,
      NUMMARKERS    = 20,
      NUMFONTS      = 22,
      NUMCOLORS     = 24,
      PDEVICESIZE   = 26,
      CURVECAPS     = 28,
      LINECAPS      = 30,
      POLYGONALCAPS = 32,
      TEXTCAPS      = 34,
      CLIPCAPS      = 36,
      RASTERCAPS    = 38,
      ASPECTX       = 40,
      ASPECTY       = 42,
      ASPECTXY      = 44,

      LOGPIXELSX    = 88,
      LOGPIXELSY    = 90,

      SIZEPALETTE  = 104,
      NUMRESERVED  = 106,
      COLORRES     = 108,

      // Printing related DeviceCaps. These replace the appropriate Escapes
      PHYSICALWIDTH   = 110,
      PHYSICALHEIGHT  = 111,
      PHYSICALOFFSETX = 112,
      PHYSICALOFFSETY = 113,
      SCALINGFACTORX  = 114,
      SCALINGFACTORY  = 115
  }

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

Please add some!

Alternative Managed API:

System.Windows.Forms.Screen.PrimaryScreen (Matt M Jacobsen)

Documentation