How to clip a CDC object?

VC6, Win98/NT

After drawing a region (with line, circle etc) to a CDC object, how can i clip the CDC object so that the final display on the View is a smaller rectangular region that i wanted.

I have looked some of the CDC clipping member functions but could not figure out how to use them.  

leowlfAsked:
Who is Participating?
 
migelConnect With a Mentor Commented:
Hi!
You can just use
CDC::SelectClipRgn(CRgn* pRgn);
create rectangular region and select it
0
 
NorbertCommented:
Did you try CWnd::InvalidateRgn ?
or CWnd::InvalidateRect ?
0
 
GlennDeanCommented:
 Have you tried the following:
  CRECT myViewRect;
  CRECT desiredRect;
  pDC->GetClipBox(&myViewRect);
   Then, from the rectangle, adjust it to the size you want and store in desiredRect.  Then call
   pDC->IntersectClipRect(&desiredRect);
     Glenn
0
 
leowlfAuthor Commented:
Thanks everyone.
0
All Courses

From novice to tech pro — start learning today.