T
T
tooman2017-02-23 20:23:49
C++ / C#
tooman, 2017-02-23 20:23:49

Scrolling issue in MFC?

Hello, there was a problem connecting a scrollbar to a window. In general, a graph is drawn in the window, while the coordinates are shifted using the following lines:

CRect r;
GetClientRect(&r);
    int x = r.Width()/2;
    int y = r.Height()/2;
    dc->SetMapMode(MM_ISOTROPIC);
    dc->SetWindowExt(1,-1);
    dc->SetViewportOrg(x,y);
    dc->SetViewportExt(1,1);

Everything is displayed as it should. In OnInitialUpdate() I create a scroll using the SetScrollSizes() function. And when I scroll down or sideways, the chart itself does not scroll, but seems to be duplicated. Thus if I use SetWindowOrg scrolling works normally. It seems to me that the matter is that the physical coordinates are not converted to logical ones. Tried to use the DPtoLP() function, tried to convert the coordinates in OnPrepareDC(), but nothing helps. I can't find examples. If anyone knows how to solve the problem, please tell me.
801951d1487843783

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question