Can I use Silverlight's WriteableBitmap to save non-visible parts of my UI to a bitmap?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 10:09:36

问题


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.


回答1:


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

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.



来源:https://stackoverflow.com/questions/6939540/can-i-use-silverlights-writeablebitmap-to-save-non-visible-parts-of-my-ui-to-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!