Invalidating the non client area

18-Dec-2016 16:08

Also, the thing you are doing down in Win Main() with Get DC() is absolutely wrong!

I see this over and over and over again by beginners, that is, using Get DC in such a manner.

Alas, my experience has shown that most people who believe either of these are wrong.

So try to exercise some judgment in choosing to do this.

Using the Invalidate Rect() i can force the client area of a window to be redrawn (completely).

In general, processing these messages for standard windows is not recommended, because the application must be able to draw all the required parts of the nonclient area for the window.Since windows cannot really understand when a non client area needs to be redrawn, i have to tell it myself. Unless you have a compelling reason for caring about the nonclient area, you can ignore it. You are probably detailed enough, it is I who must stop jumping into the middle of threads :) Do you get artefacts on the scrollbar, etc? So, i blit the dialogs background, i blit some other stuff (controls mostly), and finally i force update to the List Box.Have you tried Redraw Window on the listbox, which has a specific flag for the non-client area as well? While everything updates, the Listboxes vertical scrollbar is NOT updated.I can't get into the details of this one because it was proprietary, but that is a good example of where you would really need an odd-shaped window. If clicked, they will change color, and depending on which button is clicked, the cat's expression will change from happy to neutral to sad.The example I'm going to use here is for sheer amusement. For example, in the screen snapshot below, the caret is over the letter T and the left button has been pushed. Now, to demonstrate this is really the shape of the window, and not just a clever picture, I'll show a rather blank-looking cat reading some of the documentation that tells how to accomplish this.

In general, processing these messages for standard windows is not recommended, because the application must be able to draw all the required parts of the nonclient area for the window.

Since windows cannot really understand when a non client area needs to be redrawn, i have to tell it myself. Unless you have a compelling reason for caring about the nonclient area, you can ignore it. You are probably detailed enough, it is I who must stop jumping into the middle of threads :) Do you get artefacts on the scrollbar, etc? So, i blit the dialogs background, i blit some other stuff (controls mostly), and finally i force update to the List Box.

Have you tried Redraw Window on the listbox, which has a specific flag for the non-client area as well? While everything updates, the Listboxes vertical scrollbar is NOT updated.

I can't get into the details of this one because it was proprietary, but that is a good example of where you would really need an odd-shaped window. If clicked, they will change color, and depending on which button is clicked, the cat's expression will change from happy to neutral to sad.

The example I'm going to use here is for sheer amusement. For example, in the screen snapshot below, the caret is over the letter T and the left button has been pushed. Now, to demonstrate this is really the shape of the window, and not just a clever picture, I'll show a rather blank-looking cat reading some of the documentation that tells how to accomplish this.

Also, the reason why you told me not to use Invalidate Rect() is exactly the reason I am using it for.