visual c++ - MemDC in OnPaint()-function -
Many other drawing functions call my on-page () function.
Zero CGR :: Onepant () {CPTDC DC (this); // CMMDC DC (and DC); Dc.setViewportOrg (0, 400); Dc.setMapMode (MM_ISOTROPIC); Dc.setwindowExt (1000, 800); Dc.setViewportExt (1000, -800); Data processing (); Dracoordinate system (& amp; DC); Dragrid (& amp; DC); Draft (& amp; DC); } Example of DrawCoordianteSystem:
void CGraph :: DrawCoordinateSystem (CDC * PDC) {CPN Penblock (PS_SOLID, 1, RGB (0, 0, 0)); PDC- & gt; Selection Object (Penblack); // Rectangle in System Round PDC-> Rectangle (0, -400, 1000, 400); // Horizontal axis PDC-> Moves (0, 0); PDC- & gt; Linto (1000, 0); PDC- & gt; Settextroller (RGB (0,0,0)); PDC- & gt; Setbacker (RGB (240, 240, 240)); PDC- & gt; Textot (1001, 0, L "0"); // Vertical axis PDC-> Moovato (0, -400); PDC- & gt; Linto (0, 400); } However now I want to avoid flicker with CMEMDC, I can not find it to work right. Can anyone show me how to implement CMEMDC correctly?
Then load the memory DC with bitmap on the bitcab in DC .
Try doing something like this:
CDC DCM; Cmtmap bitmap; DcMem.CreateCompatibleDC (PDC); Bitmap.CreateCompatibleBitmap (PDC, RucketWithth), rect.Height ()) CBITMAP * pOldBitmap = dcMem.SelectObject (& amp; Bitmap); ... drawing for all your DCMM ... PDC- & gt; Bitbattle (rect.left, rect.top, rect.Width), rect.Height (), and amp; DCMem, 0, 0, SRCCOPY); DcMem.SelectObject (pOldBitmap)
Comments
Post a Comment