MFC drawing 1--using different DCs

Source: Internet
Author: User

///using HDC drawing
//
HDC HDC;
Hdc=::getdc (m_hwnd);
Movetoex (Hdc,m_ptorigin.x,m_ptorigin.y,null);
LineTo (HDC,POINT.X,POINT.Y);
:: ReleaseDC (M_HWND,HDC);
*/
//All window-related operations are encapsulated in the CWnd class
//All drawing-related operations are encapsulated in the CDC class
//using CDC drawing
//
CDC *PDC=CWND::GETDC ();
// The GetDC of the CWnd class is used here directly, and its return value is HDC
Pdc->moveto (M_ptorigin) that is returned using a function of the same name in the cdc*
//sdk;
Pdc->lineto (point);
Cwnd::releasedc (PDC);
*/
//using the CCLIENTDC drawing
/*
CClientDC derives from the CDC, calling GetDC at construction time,
calling ReleaseDC at the time of the destructor. So that we don't have to
Show call GetDC and ReleaseDC.
*/
/*
CCLIENTDC DC (this);
DC. MoveTo (M_ptorigin);
DC. LineTo (point);
*/
//using the CWINDOWDC drawing
/*
also derives from the CDC, constructs the call GETWINDOWDC, and calls ReleaseDC () on the
destructor. The
can access the entire screen area, including the client area and the non-
client area.
*/
/*
CWINDOWDC DC (this);
DC. MoveTo (M_ptorigin);
DC. LineTo (point);
*/
//via GetDesktopWindow get desktop DC
/*
Note: A handle is obtained with the Platform SDK function with the same name, and a function with the same name in CWnd
obtains the CWnd pointer. You can use this function to get the
Desktop window's CWnd pointer so that we can manipulate the desktop.
*/
/*
CWINDOWDC DC (GetDesktopWindow ());
DC. MoveTo (M_ptorigin);
DC. LineTo (point);
*/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.