Link to home
Start Free TrialLog in
Avatar of leowlf
leowlf

asked on

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.  

Avatar of Norbert
Norbert
Flag of Germany image

Did you try CWnd::InvalidateRgn ?
or CWnd::InvalidateRect ?
Avatar of GlennDean
GlennDean

 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
ASKER CERTIFIED SOLUTION
Avatar of migel
migel

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of leowlf

ASKER

Thanks everyone.