Using C#, I’m trying to draw an instance of a control, say a panel or button, to a bitmap in my Pocket PC application. .NET controls has the nifty DrawToBitmap function, but it does not exist in .NET Compact Framework.
How would I go about painting a control to an image in a Pocket PC application?
DrawToBitmapin the full framework works by sending theWM_PRINTmessage to the control, along with the device context of a bitmap to print to. Windows CE doesn’t includeWM_PRINT, so this technique won’t work.If your control is being displayed, you can copy the image of the control from the screen. The following code uses this approach to add a compatible
DrawToBitmapmethod toControl: