Я использую следующую процедуру, чтобы получить область прямоугольника, выбранную мышью пользователя.Но в настоящее время он выбирает регион на основе видимого представления, но не на весь прокручиваемый вид.Интересно, есть ли способ получить значение смещения (0,0) в видимом представлении.То есть я хочу найти (x, y) во всей прокручиваемой области, соответствующей (0,0) в видимой области.
ОБНОВЛЕНИЕ: найдено GetScrollPosition ().
// COpenCVTestView message handlers
void COpenCVTestView::OnLButtonDown(UINT nFlags, CPoint point)
{
anchor = endpoint = point;
CClientDC dc(this);
dc.DrawFocusRect(&CRect(anchor.x, anchor.y, endpoint.x, endpoint.y));// very small rectangle
SetCapture();
}
void COpenCVTestView::OnLButtonUp(UINT nFlags, CPoint point)
{
if(GetCapture() != NULL)
{ /* banding */
COpenCVTestDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
CClientDC dc(this);
dc.DrawFocusRect(&CRect(anchor.x, anchor.y, endpoint.x, endpoint.y));
pDoc->m_recSelection = CRect(anchor.x, anchor.y, point.x, point.y);
ReleaseCapture();
InvalidateRect(&(pDoc->m_recSelection));
} /* banding */
}
void COpenCVTestView::OnMouseMove(UINT nFlags, CPoint point)
{
if(GetCapture() != NULL)
{ /* rubber band */
CClientDC dc(this);
dc.DrawFocusRect(&CRect(anchor.x, anchor.y, endpoint.x, endpoint.y));
endpoint = point;
dc.DrawFocusRect(&CRect(anchor.x, anchor.y, endpoint.x, endpoint.y));
} /* rubber band */
}