开发者

Render Multiple Controls To Image

开发者 https://www.devze.com 2023-01-11 23:17 出处:网络
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 locat

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号