user4129935
user4129935

Reputation:

Are child controls painted after the parent Window?

Say I have the following Window with a Button:

enter image description here

If I minimize and restore the Window, then two WM_PAINT messages will be sent, one for the Window and one for the Button.

The WM_PAINT message for the Window will request that the entire Window to be repainted, and the WM_PAINT message for the Button will request that the Button to be repainted.

What if the Button is repainted first, and then the Window is repainted, wouldn't this means that the painting for the Window will cover the Button and make it invisible? So does that means that the Window is painted before the Button?

Upvotes: 1

Views: 672

Answers (1)

David Heffernan
David Heffernan

Reputation: 613003

Are child controls painted after the parent Window?

Yes.

Painting for children with the same parent (siblings) is rather complex. That topics is covered here: MSDN: Child Window Update Region.

Upvotes: 3

Related Questions