WinForms FAQ - from GDI

Find answers for the most frequently asked questions
Expand All Collapse All

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

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

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

Share with

Couldn't find the FAQs you're looking for?

Please submit your question and answer.