Here is the short of my question: in a custom control, is there a way to get a parent paint/bitblt its children controls to a background image, but not have the children controls actually paint on the control?
Details:
I am trying to roll my own double buffering (on the compact framework) and am having a lot of problems. I have a fairly complex user control. It has a view Panel
(fixed size) with scroll Panel
(variable size) in it. The scroll Panel
has several card Panels
in it. The card panels are stacked vertically contain two DataGrids
and two Labels
.
Here is a visual outline of my control
View Panel | +--> Scroll Panel | +---> Card Panel | | | +--> Label | +--> Label | +--> Data Grid | +--> Data Grid | +---> Card Panel | | | +--> Label | +--> Label | +--> Data Grid | +--> Data Grid (...)
OK, so now to the problem. I override the on paint for the Scroll Panel and do a bitblt to get an image to show as a "custom painting". I tested the image by saving it off and it is exactly what I want.
The problem is that the datagrids and labels still do their normal painting. So when I scroll then are leaving artifacts behind. So, I override the OnPaint to do nothing for the grid and the label. But when I do that the bitblt does not pickup the grids anymore (but oddly it picks up the labels still).
So, in a custom control, is there a way to get a parent paint/bitblt its children controls to a background image, but not have the children controls actually paint on the control?
NOTE: If you are interested to see my full code you can see it here.