0

I am new to win32 programming and have a very naive question.

Say there is my application window of size 1920x1280 and I create a child window over it of size 1920x2560 (double of vertical screen size). Now I load an image onto this child window which has the same size as that of child window i.e 1920x2560.

Now my question is If I use ScrollWindow for vertical scroll, will I necessarily need to repaint the dirty rect (the bottom part), since the image would be already loaded? Is it not possible to avoid that and just move the screen buffers ? Or is there any other way possible to avoid redrawing, may be using bitmaps or something?

7
  • 1
    Windows don't remember their contents when they're obscured. You need to repaint them when they come into view. Commented Dec 1, 2022 at 4:15
  • Thanks for the answer @JonathanPotter i also got the similar hint. Does using bitmap help here (i saw scrolling option is available in bitmap as well) or is the bitmap also limited to device screen size ? There must be something to do fast drawing. My app is taking almost 16-20 ms for single scroll event. Any suggestions here? question is specific to scrolling Commented Dec 1, 2022 at 6:23
  • If you have your image as a bitmap then instead of using ScrollWindow to shuffle the existing bits, just redraw the whole display from the new origin within the bitmap. Commented Dec 1, 2022 at 6:41
  • Say I am scrolling up, Are you suggesting that rather than doing ScrollWindow and invalidating the bottom part of the screen, I should redraw the full screen window and avoid calling ScrollWindow all together ? Will that be faster? Commented Dec 1, 2022 at 6:54
  • I wouldn't be surprised if it would be quicker. Certainly easy to test. Commented Dec 1, 2022 at 9:48

1 Answer 1

-1

An application draws in a window when scrolling, changing, or selecting a portion of the displayed data

but you could only draw the differences in the Update Region.
It's also noted that disabling the default handling for the WM_ERASEBKGND message makes smooth.
The disadvantage of your idea is always drawing outside of client area and how to just move the screen buffers to avoid redrawing?

Sign up to request clarification or add additional context in comments.

2 Comments

My thought was If we could simply move screen buffers, I could create a large childwindow and update the invisible part of its hwnd in some background thread as per my convenience. Since ScrollWindow moves screen buffers in 1ms , I will be practically able to handle one scroll wheelevent in 1ms and give smooth scroll experience

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.