CHwndRenderTarget Class
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at CHwndRenderTarget Class.
A wrapper for ID2D1HwndRenderTarget.
class CHwndRenderTarget : public CRenderTarget;
Public Constructors
| Name | Description |
|---|---|
| CHwndRenderTarget::CHwndRenderTarget | Constructs a CHwndRenderTarget object from HWND. |
Public Methods
| Name | Description |
|---|---|
| CHwndRenderTarget::Attach | Attaches existing render target interface to the object |
| CHwndRenderTarget::CheckWindowState | Indicates whether the HWND associated with this render target is occluded. |
| CHwndRenderTarget::Create | Creates a render target associated with the window |
| CHwndRenderTarget::Detach | Detaches render target interface from the object |
| CHwndRenderTarget::GetHwnd | Returns the HWND associated with this render target. |
| CHwndRenderTarget::GetHwndRenderTarget | Returns ID2D1HwndRenderTarget interface. |
| CHwndRenderTarget::ReCreate | Re-creates a render target associated with the window |
| CHwndRenderTarget::Resize | Changes the size of the render target to the specified pixel size |
Public Operators
| Name | Description |
|---|---|
| CHwndRenderTarget::operator ID2D1HwndRenderTarget* | Returns ID2D1HwndRenderTarget interface. |
Protected Data Members
| Name | Description |
|---|---|
| CHwndRenderTarget::m_pHwndRenderTarget | A pointer to an ID2D1HwndRenderTarget object. |
Header: afxrendertarget.h
Attaches existing render target interface to the object
void Attach(ID2D1HwndRenderTarget* pTarget);
Parameters
pTarget
Existing render target interface. Cannot be NULL
Indicates whether the HWND associated with this render target is occluded.
D2D1_WINDOW_STATE CheckWindowState() const;
Return Value
A value that indicates whether the HWND associated with this render target is occluded.
Constructs a CHwndRenderTarget object from HWND.
CHwndRenderTarget(HWND hwnd = NULL);
Parameters
hwnd
The HWND associated with this render target
Creates a render target associated with the window
BOOL Create(HWND hWnd);
Parameters
hWnd
The HWND associated with this render target
Return Value
If the method succeeds, it returns TRUE. Otherwise, it returns FALSE
Detaches render target interface from the object
ID2D1HwndRenderTarget* Detach();
Return Value
Pointer to detached render target interface.
Returns the HWND associated with this render target.
HWND GetHwnd() const;
Return Value
The HWND associated with this render target.
Returns ID2D1HwndRenderTarget interface.
ID2D1HwndRenderTarget* GetHwndRenderTarget();
Return Value
Pointer to an ID2D1HwndRenderTarget interface or NULL if object is not initialized yet.
A pointer to an ID2D1HwndRenderTarget object.
ID2D1HwndRenderTarget* m_pHwndRenderTarget;
Returns ID2D1HwndRenderTarget interface.
operator ID2D1HwndRenderTarget*();
Return Value
Pointer to an ID2D1HwndRenderTarget interface or NULL if object is not initialized yet.
Re-creates a render target associated with the window
BOOL ReCreate(HWND hWnd);
Parameters
hWnd
The HWND associated with this render target
Return Value
If the method succeeds, it returns TRUE. Otherwise, it returns FALSE.
Changes the size of the render target to the specified pixel size
BOOL Resize(const CD2DSizeU& size);
Parameters
size
The new size of the render target in device pixels
Return Value
If the method succeeds, it returns TRUE. Otherwise, it returns FALSE.