COleControl::GetDC

CDC* GetDC( LPCRECT lprcRect = NULL, DWORD dwFlags = OLEDC_PAINTBKGND );

Return Value

Pointer to the display device context for the container CWnd client area if successful; otherwise, the return value is NULL. The display device context can be used in subsequent GDI functions to draw in the client area of the container's window.

Parameters

lprcRect

A pointer to the rectangle the windowless control wants to redraw, in client coordinates of the control. NULL means the full object’s extent.

dwFlags

Drawing attributes of the device context. Choices are:

Remarks

Call this function to provide a means for a windowless object to get a screen (or compatible) device context from its container. The ReleaseDC member function must be called to release the context after painting. When calling GetDC, objects pass the rectangle they wish to draw into in their own client coordinates. GetDC translates these to coordinates of the container client area. The object should not request a desired drawing rectangle larger than its own client area rectangle, the size of which can be retrieved with GetClientRect. This prevents objects from inadvertently drawing where they are not supposed to.

COleControl OverviewClass MembersHierarchy Chart

See Also   COleControl::ReleaseDC