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_ACTIVEBORDER ActiveBorder
COLOR_ACTIVECAPTION ActiveCaption
COLOR_CAPTIONTEXT ActiveCaptionText
COLOR_APPWORKSPACE AppWorkspace
COLOR_3DFACE Control
COLOR_3DSHADOW ControlDark
COLOR_3DDKSHADOW ControlDarkDark
COLOR_3DLIGHT ControlLight
COLOR_3DHIGHLIGHT ControlLightLight
COLOR_BTNTEXT ControlText
COLOR_DESKTOP Desktop
COLOR_GRAYTEXT GrayText
COLOR_HIGHLIGHT Highlight
COLOR_HIGHLIGHTTEXT HighlightText
COLOR_HIGHLIGHT HotTrack
COLOR_INACTIVEBORDER InactiveBorder
COLOR_INACTIVECAPTION InactiveCaption
COLOR_INACTIVECAPTIONTEXT InactiveCaptionText
COLOR_INFOBK Info
COLOR_INFOTEXT InfoText
COLOR_MENU Menu
COLOR_MENUTEXT MenuText
COLOR_SCROLLBAR ScrollBar
COLOR_WINDOW Window
COLOR_WINDOWFRAME WindowFrame
COLOR_WINDOWTEXT WindowText
COLOR_3DHILIGHT ControlLightLight
COLOR_BTNHIGHLIGHT ControlLightLight
COLOR_BTNHILIGHT ControlLightLight
COLOR_BACKGROUND Desktop
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.