Visual C + + Print programming technology-memory device environment

Source: Internet
Author: User

Memory Device Environment

A memory device environment is an environment in which no device is associated with it. A memory device environment compatible with a standard device environment is generally used to copy a bitmap to the screen. You can do this by creating a memory device environment that is compatible with a standard device environment, then copying the bitmap you want to display into a memory device environment, and finally copying the bitmap from the memory device environment to the real device environment.

eg

void Cmainframe::onbitmapdraw () {cdc* pcdc=getdc ();//Get current device context CBitmap bitmap;  Define CBitmap Object Bitmap.loadbitmap (idb_bitmap_1); Loads the specified ID bitmap object        CDC MEMDC;   Defines the memory context information, which is not created by new, is automatically freed and does not need to display the call RELEASEDCMEMDC.CREATECOMPATIBLEDC (PCDC); Creates a memory context compatible with the specified device                                                                   //Here is the form memdc.selectobject (&BITMAP);//select object to Memory environment context bitmap BMINFO;//BITMAP structure                      The BITMAP structure defines the type, width, height, color           format, and bit values of a bitmap.bitmap.GetObject (size Of (Bminfo), &bminfo); Retrieve bitmap image information, assign to Bminfo (get image Height-width information) pcdc->bitblt (100,0,bminfo.bmwidth,bminfo.bmheight,&memdc,0,0,srccopy) ;//Copy the Memory Environment mountain context to the device context ReleaseDC (PCDC);}

  

Visual C + + Print programming technology-memory device environment

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.