[英]WP8 Blank image being saved to Library
我正在尝试将图像保存到手机的照片库中。 这是XAML标记。
<Canvas x:Name="canMeme" HorizontalAlignment="Left" Height="400" Margin="26,134,0,0" VerticalAlignment="Top" Width="400">
<Image x:Name="imgMeme" Height="400" Width="400"/>
<TextBlock x:Name="topText" Width="400" TextWrapping="Wrap" HorizontalAlignment="Center" FontWeight="Bold" TextAlignment="Center" Text="Am i the only one around here" FontSize="40" Foreground="White"/>
<TextBlock x:Name="bottomText" TextWrapping="Wrap" Text="TextBlock" Canvas.Top="372" Width="400" HorizontalAlignment="Center" TextAlignment="Center" FontWeight="Bold" Height="28" Margin="0,0,0,20" />
</Canvas>
我正在尝试将“画布”保存到图像中。 将在运行时为文本框以及图像提供值。 这是我要做的代码:
try
{
using (MemoryStream ms = new MemoryStream())
{
Extensions.SaveJpeg(imagebitmap, ms, imagebitmap.PixelWidth, imagebitmap.PixelHeight,0,100);
ms.Seek(0, SeekOrigin.Begin);
library.SavePicture(string.Format("Images\\{0}.jpg", name.ToString()), ms);
}
MessageBox.Show(string.Format("Image has been saved as {0}", name.ToString()));
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
该代码运行,但随后似乎会生成一个空图像。 有什么我想念的吗?
您忘记了将XAML与实际位图绑定。
您可以阅读有关MSDN上绑定的更多信息
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.