How to do this drawing in .Net?

G

Galaxia

Hi All,

To plot a circle with changeable radius by moving mouse operation, I always write "pDC->SetROP2(R2_NOTXORPEN)" in Visual C++. My question is how to realize it in .Net (I'm using VS 2003). The following is a section of plotting a circle.

void TCircleMaze::plotCircle(int m_CirNo,CDC * pDC)
{
CRect rect;
CPen * def_pen = pDC->SelectObject(&redPen);

int def_R2 = pDC->SetROP2(R2_NOTXORPEN);

rect = m_devCircle.GetRect();
pDC->Ellipse(&rect); // circle

// retrieve
pDC->SelectObject(def_pen);
pDC->SetROP2(def_R2);

return;
}

--
"Forward Galaxia"
 
G

Galaxia

Thank you very much. It's great helpful.

--
"Forward Galaxia"

"Ian Griffiths [C# MVP]" <[email protected]>
XOR is not supported in GDI+ and for good reasons. See here:

http://www.interact-sw.co.uk/graphics/xorconsideredharmful/

and here:

http://www.interact-sw.co.uk/iangblog/2004/03/19/xorartifacts

The first article explains what you should do instead and why it works
better than XOR ever did. The second refers to an example of why XOR is a
really bad way of doing this.


--
Ian Griffiths - http://www.interact-sw.co.uk/iangblog/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top