Home > Software engineering >  Rookie help [MFC pDC -> the Ellipse circle] be obliged!
Rookie help [MFC pDC -> the Ellipse circle] be obliged!

Time:10-02



As two figures above, change the size of the circle, the icon is covered, how to change circle size appears only a circle, icon will not be covered again??
(probably is this meaning, forgive me,

CodePudding user response:

Put all drawing operations in ontouch,

CodePudding user response:

Double buffer drawing good memory draw on interface drawing operations inside the OnPaint completed

CodePudding user response:

Before the Ellipse selected to an empty brush or a background color of the brush

 
Void CSDI2View: : ontouch * pDC (CDC)
{
CSDI2Doc * pDoc=GetDocument ();
ASSERT_VALID (pDoc);
//TODO: add the draw code for native data here

Int nSaveDC=pDC - & gt; SaveDC ();

//the background transparent
Int nBkMode=pDC - & gt; SetBkMode (TRANSPARENT);

//set the font color
COLORREF txColorSave=pDC - & gt; SetTextColor (RGB (255, 0, 0));

//create & amp; Elected to the font
CFont mFont;
MFont. CreatePointFont (240, _T (" Arial "));
CFont * pOldFont=pDC - & gt; SelectObject (& amp; MFont);

Cstrings sText=_T (" Test the Ellipse ");
PDC - & gt; TextOut (10, 10, sText);


//for air brush
The CBrush * pOldBrush=(CBrush *) pDC - & gt; SelectStockObject (NULL_BRUSH);

//elected to brush
CPen pen (PS_SOLID, 1, RGB (0, 0, 255));
CPen * pOldPen=pDC - & gt; SelectObject (& amp; Pen);

PDC - & gt; The Ellipse (0, 0, 100, 100);

//restore brush
PDC - & gt; SelectObject (pOldPen);

//restore brush
PDC - & gt; SelectObject (pOldBrush);

//resume font
PDC - & gt; SelectObject (pOldFont);

//resume font color
PDC - & gt; SetTextColor (txColorSave);

//recovery background model
PDC - & gt; SetBkMode (nBkMode);

PDC - & gt; RestoreDC (nSaveDC);

}

  • Related