I wish to off-screen render a Control to some bitmap so that I have quick access to it.
Unfortunately Control.DrawToBitmap
seems to draw the entire control on which it is called including all it's child controls. Internally it issues a WM_PRINT message with self-provided DC to a bitmap. This temporary bitmap is then blitted to the user-provided Bitmap. Unacceptable for me, I'd rather have this bitmap updated as needed so my performance hit when the bitmap is needed is minimized.
In the ideal scenario I'd want the form to behave as if it were visible on the screen (but it cannot be). That would mean that if, say, some Control has its Text
property changed, the form would be partially invalidated. Catching the relevant messages/events would then allow me to either specify my own DC for the form to be drawn on, or to simply BitBlt the forms DC to my own.
Some directions I have looked in:
PaintEventArgs
parameter in OnPaint
seems to hold a member savedGraphicsState, perhaps it could be used to figure out what doesn't require invalidatingIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With