Render Multiple Controls To Image
How can I render multiple controls (or the same control) to a bitmap on specified locations. For example render control1 in it's full size to the location (50;50) and contro开发者_JAVA技巧l2 at location (100;100) and so forth.
I've a control that needs to be rendered 6 times side-by-side on an image with a single property changed in each rendering.
RenderTargetBitmap has the render function, but it doesn't allow me to specify where on the image I want my control rendered.
Try positioning the controls in a canvas, then render the canvas to a bitmap.
When you have your bitmap renderings you can put them inside a DrawingGroup which allows you to specify exactly where in the resulting drawing they should be drawn.
To put images inside a drawinggroup, you'd have to use ImageDrawing. There's an example that does this on the DrawingGroup msdn page linked above.
精彩评论