ID2D1DCRenderTarget::BindDC method
Binds the render target to the device context to which it issues drawing commands.
Syntax
virtual HRESULT BindDC( const HDC hDC, [in] const RECT *pSubRect ) = 0;
Parameters
- hDC
-
Type: const HDC
The device context to which the render target issues drawing commands.
- pSubRect [in]
-
Type: const RECT*
The dimensions of the handle to a device context (HDC) to which the render target is bound.
Return value
Type: HRESULT
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Remarks
Before you can render with the DC render target, you must use its BindDC method to associate it with a GDI DC. You do this each time you use a different DC, or the size of the area you want to draw to changes.
Examples
In the preceding code, m_pD2DFactory is a pointer to an ID2D1Factory, and m_pDCRT is a pointer to an ID2D1DCRenderTarget.
The next code example binds a DC to the ID2D1DCRenderTarget.
HRESULT DemoApp::OnRender(const PAINTSTRUCT &ps)
{
// Get the dimensions of the client drawing area.
GetClientRect(m_hwnd, &rc);
// Bind the DC to the DC render target.
hr = m_pDCRT->BindDC(ps.hdc, &rc);
Requirements
|
Minimum supported client |
Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | Windows Store apps] |
|---|---|
|
Minimum supported server |
Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | Windows Store apps] |
|
Minimum supported phone |
Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps] |
|
Header |
|
|
Library |
|
|
DLL |
|
See also