We help IT Professionals succeed at work.

Scroll bars - Painting in a window

viswanathat
viswanathat asked
on
IDE : VC5

I am creating a window  control inside a dialog and drawing horizontal and vertical lines inside that to make it as a grid control.

The window has horizontal and vertical scrool bars and I am handling these scroll events and repainting the uncovered area to show rest of the grid.

In windows NT, when horizontal scroll bar is used the grid is not repainted in the area newly made visible.

But It is working perfectly in windows 2000.
Is the difference in MSVCrt,MSVCirt,MFC42,GDI32 dlls in these OS   can cause these problems?

The code is

GetClientRect(&rc);
ScrollWindow(iScrollPos,0,&rc,&rc);

Where iScrollPos is the value I am calculating to fix the number of columns to be moved.


While debugging The OnHScroll-scrollwindow calls onpaint and draws all the lines
but it is not displayed in the moved portion.


What could be the problem?

Either calling update window or passing rc = NULL is not solving it.

Regards.
Viswanath
Comment
Watch Question

Viswanath,

I vaguely remember having such a problem which I fixed by using ScrollWindowEx. It has an SW_INVALIDATE flag which causes the newly uncovered area to be invalidated and subsequently repainted.

Try:
GetClientRect(&rc)
ScrollWindowEx(iScrollPos, 0, &rc, NULL, NULL, NULL, SW_INVALIDATE);

Regards,
Mike
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered by: MTPudelko

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Roshan Davis
EE Cleanup Volunteer

Explore More ContentExplore courses, solutions, and other research materials related to this topic.