Font::Font(HDC) method (gdiplusheaders.h)

Creates a Font::Font object based on the Windows Graphics Device Interface (GDI) font object that is currently selected into a specified device context. This constructor is provided for compatibility with GDI.


void Font(
  [in] HDC hdc


[in] hdc

Type: HDC

Handle to a Windows device context that has a font selected. A handle is a number that Windows uses internally to reference an object.

Return value



In most cases when you obtain a device context handle by calling the GetHDC method of a Graphics object, the device context will not have a font selected. If you pass such a handle to this constructor, the constructor will fail.

A device context is a structure that is maintained internally. It is associated with a particular device, such as a video monitor or a printer. There is usually one device context associated with each window displayed on a video monitor. A device context contains some graphics attributes used by GDI+.


Minimum supported client Windows XP, Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header gdiplusheaders.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See also

Changes in the Programming Model


Using Text and Fonts