我可以使用Silverlight的WriteableBitmap将UI的不可见部分保存到位图吗? [英] Can I use Silverlight's WriteableBitmap to save non-visible parts of my UI to a bitmap?

查看:81
本文介绍了我可以使用Silverlight的WriteableBitmap将UI的不可见部分保存到位图吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说我有一些网格,您需要向下滚动才能看到其所有行,并且我有兴趣保存一些当前不可见为位图的行.是可行的,还是我必须真正向下滚动,拍摄快照",然后再次向上滚动?

Say I have some grid that you need to scroll down to see all of its lines, and I'm interested in saving some lines that are not currently visible as a bitmap. Is it feasible, or do I have to actually scroll down, "take a snapshot", and then scroll up again?

这是一个可行性问题,因此我没有要共享的代码.

This is a feasibility question, and thus I don't have code to share.

推荐答案

是.您可以将任何UIElement(及其子元素)呈现为可写位图.

Yes. You can render any UIElement (and its children) to a writeable bitmap.

执行此操作时,还要指定一个转换.这意味着您可以显示UIElement的任何部分(如果您不希望全部显示).

When you do that you also specify a transform. That means you can display any part of the UIElement (if you do not want it all).

它在屏幕上是否可见"与位图渲染完全无关.它不像抓屏那样工作.

Whether it is "visible" on screen is completely irrelevant to bitmap rendering. It does not work like a screen grab.

输出裁剪仅可缩小到目标位图和提供的渲染转换的大小.

The output cropping is solely down to the size of the target bitmap and the render transform provided.

例如

As an example Silverlight Rotate & Scale a bitmap image to fit within rectangle without cropping uses UIElements that are never part of the visual tree to create a bitmap that is then rendered.

这篇关于我可以使用Silverlight的WriteableBitmap将UI的不可见部分保存到位图吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆