GetClipRgn

  • Thread starter Thread starter M Woolcott
  • Start date Start date
M

M Woolcott

Trying to use GetClipRgn from "OnDraw" (Visual C++ 2005), Windows XP. The
code is:

HRGN hRgnClip = CreateRectRgn(rcPaint.left, rcPaint.top, rcPaint.right,
rcPaint.bottom);
int nRet = GetClipRgn(pDC->m_hDC, hRgnClip);
bool bHasClipRgn = (nRet == 1);
..
..

"bHasClipRgn" is never True. Any ideas?
 
"bHasClipRgn" is never True. Any ideas?

You forgot to select the region into the device context.

HRGN hRgnClip = CreateRectRgn(rcPaint.left, rcPaint.top, rcPaint.right,
rcPaint.bottom);
HGDIOBJ hOldRgnClip = SelectObject(pDC->m_hDC, hRgnClip )// <------Add this
line
int nRet = GetClipRgn(pDC->m_hDC, hRgnClip);
bool bHasClipRgn = (nRet == 1);
 

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

Back
Top