如何在 Silverlight 中捕获部分屏幕 [英] how to capture part of the screen in Silverlight
本文介绍了如何在 Silverlight 中捕获部分屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从应用程序中对正在运行的 Silverlight 3 应用程序进行屏幕截图,然后我想将其作为缩略图呈现给用户,例如在图像控件中.
i want to do a screen capture of a running silverlight 3 application, from within the app, and then i want to present this to the user as a thumbnail, say in an Image control.
我在做梦吗?
推荐答案
对于一个简单的页面:
<Grid x:Name="LayoutRoot" Background="White">
<StackPanel>
<Ellipse Fill="Red" Width="100" Height="100"></Ellipse>
<Button x:Name="btnCapture" Click="btnCapture_Click" Width="30" Height="25"></Button>
<Image x:Name="imgThumbnail" Width="50" Height="50"></Image>
</StackPanel>
</Grid>
使用事件处理程序:
private void btnCapture_Click(object sender, RoutedEventArgs e)
{
WriteableBitmap bmp = new WriteableBitmap(LayoutRoot, null);
this.imgThumbnail.Source = bmp;
}
这篇关于如何在 Silverlight 中捕获部分屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文