WinForms FAQ - from GDI

How do the Win32 System Colors map to the colors provided by System.Drawing.SystemColors?

The following table lists all Win32 System Colors and the corresponding name in System.Drawing.SystemColors type:

GetSysColor(n)SystemColors.
COLOR_ACTIVEBORDERActiveBorder
COLOR_ACTIVECAPTIONActiveCaption
COLOR_CAPTIONTEXTActiveCaptionText
COLOR_APPWORKSPACEAppWorkspace
COLOR_3DFACEControl
COLOR_3DSHADOWControlDark
COLOR_3DDKSHADOWControlDarkDark
COLOR_3DLIGHTControlLight
COLOR_3DHIGHLIGHTControlLightLight
COLOR_BTNTEXTControlText
COLOR_DESKTOPDesktop
COLOR_GRAYTEXTGrayText
COLOR_HIGHLIGHTHighlight
COLOR_HIGHLIGHTTEXTHighlightText
COLOR_HIGHLIGHTHotTrack
COLOR_INACTIVEBORDERInactiveBorder
COLOR_INACTIVECAPTIONInactiveCaption
COLOR_INACTIVECAPTIONTEXTInactiveCaptionText
COLOR_INFOBKInfo
COLOR_INFOTEXTInfoText
COLOR_MENUMenu
COLOR_MENUTEXTMenuText
COLOR_SCROLLBARScrollBar
COLOR_WINDOWWindow
COLOR_WINDOWFRAMEWindowFrame
COLOR_WINDOWTEXTWindowText
COLOR_3DHILIGHTControlLightLight
COLOR_BTNHIGHLIGHTControlLightLight
COLOR_BTNHILIGHTControlLightLight
COLOR_BACKGROUNDDesktop
Permalink
Can I mix GDI and GDI+ drawing in my application?

You can mix GDI and GDI+ drawing operations in the same code path. The article INFO: Interoperability Between GDI and GDI+ (Q311221) discusses some caveats to keep in mind when you are writing code that allows GDI and GDI+ to interoperate.

See also the FAQ ‘How to create my own hatch styles for brushes’ for an example how to use GDI bitmaps with GDI+.

The most prominent functions for mixing GDI and GDI+ are the GetHdc and ReleaseHdc methods of the Graphics class.

Permalink
How do I do XOR-type-drawing (SetROP2-Function in MFC) in GDI+

GDI+ doesn’t support ROP codes like XOR. To use XOR drawing mode, interop with GDI.

Permalink
How does text drawing differ between GDI+ and GDI

GDI+ text layout is resolution independent, and forms built with GDI+ text look the same at all resolutions and when printed. The GDI+ APIs DrawString and MeasureString lay out text independent of device resolution, so a paragraph of text takes the same number of lines, no matter what the display device.

Permalink