알고리즘

사각형 그리기

조규현15 2015. 2. 13. 14:49
반응형

void CTest2View::DrawImage(CDC* pDC)

{

CTest2Doc* doc = GetDocument();

CRect cr = doc->LoadArray();


CPen pen,pen2,pen3, *pOldPen;

pen.CreatePen(PS_DOT, 1, RGB(255,255,255));

pen2.CreatePen(PS_DOT, 1, RGB(0,0,0));

pen3.CreatePen(PS_SOLID, 1, RGB(0,0,0));


CBrush Brush, *pOldBrush;

pOldBrush = (CBrush *)pDC->SelectStockObject(NULL_BRUSH);


if(plag)

{

pDC->SetROP2(R2_NOT);


pOldPen = (CPen *)pDC->SelectObject(&pen);

pDC->Rectangle(preXY.x,preXY.y,opreXY.x,opreXY.y);


pOldPen = (CPen *)pDC->SelectObject(&pen2);

pDC->Rectangle(preXY.x,preXY.y,currentXY.x,currentXY.y);

}

else

{

pOldPen = (CPen *)pDC->SelectObject(&pen3);

pDC->Rectangle(cr);

}

pDC->SelectObject(pOldBrush);

pDC->SelectObject(pOldPen);

}


반응형