Home > Software engineering >  GetScrollPosition in ontouch () function call will interrupt
GetScrollPosition in ontouch () function call will interrupt

Time:09-30

Void CCTCS3View: : ontouch * pDC (CDC)
{
CRect rc;
The CDC MemDC;
CBitmap MemBitmap;
GetClientRect (& amp; Rc);
CPoint scrollPt=GetScrollPosition ();
MemDC. CreateCompatibleDC (pDC);
MemDC. SetViewportOrg (- scrollPt);
MemBitmap. CreateCompatibleBitmap (pDC, rc Width (), rc, Height ());
CBitmap * pOldBitmap=MemDC. SelectObject (& amp; MemBitmap);
MemDC. FillSolidRect (scrollPt. X, scrollPt. Y, rc. The Width (), rc, Height (), RGB (0, 0));
//drawing

PDC - & gt; SetViewportOrg (0, 0);
PDC - & gt; BitBlt (0, 0, rc. Width (), rc, Height (), & amp; MemDC scrollPt. X, scrollPt. J y, SRCCOPY);
MemBitmap. DeleteObject ();
MemDC. DeleteDC ();
}
Main code as above, but call GetScrollPosition () will interrupt, comment out wouldn't, call no problem elsewhere, call other functions also won't appear the problem of interrupt CScrollView,
I want to ask next, how to solve this problem, if not solve GetScrollPosition () function to obtain the coordinates of the obtained by other functions,

CodePudding user response:

Is
GetScrollPos (SB_HORZ),
GetScrollPos (SB_VERT)

CodePudding user response:

reference 1st floor schlafenhamster response:
is
GetScrollPos (SB_HORZ),
GetScrollPos (SB_VERT)

It can be get coordinates, but drawing still not successful, has been flashing, pictures can't follow moving sliders, what reason is this?

CodePudding user response:

MemDC. SetViewportOrg (- scrollPt);
PDC - & gt; SetViewportOrg (0, 0);

Don't
  • Related