IFont::SetHdc  4LDP.U

Provides a device context to the font that describes the logical mapping mode.

HRESULT SetHdc(

    HDC hdc

//Device context handle

   );

 

 

Parameters

hdc

[in] Handle to the device context in which to select the font.

 

Return Values

The method supports the standard return value E_INVALIDARG, as well as the following:

S_OK

The font was selected successfully.

E_NOTIMPL

The font selection is not supported through this font object.

 

Remarks

The logical mapping mode affects the font s internal computation of its point size so that when the caller asks for a font handle by calling IFont::GetHfont, the font is already properly scaled to the device context.

Notes to Callers

The caller retains ownership of this device context which must remain valid for the lifetime of the font object. Thus, the device context passed should be a memory device context (from the Win32 function CreateCompatibleDC) and not a screen device context (from CreateDC, GetDC, or BeginPaint) because screen device contexts are a limited system resource.