gpt4 book ai didi

c# - 图片无法在 Windows Phone 7.5 上完全加载

转载 作者:太空宇宙 更新时间:2023-11-03 22:05:00 24 4
gpt4 key购买 nike

我的 WP7.5 Silverlight 应用程序中有一个图像元素,我尝试在 XAML 中和以编程方式更改其源代码。无论我尝试什么,我都无法完全加载大图像(大小或字节,我不知道)。

这是我的代码:

<controls:PanoramaItem>
<ScrollViewer VerticalAlignment="Top" VerticalScrollBarVisibility="Auto" Margin="2, 4, 0, 0" HorizontalScrollBarVisibility="Disabled">
<StackPanel x:name="stackPanel">
<TextBlock x:Name="debugger" Foreground="Black"/>
<Image Source="http://d24w6bsrhbeh9d.cloudfront.net/photo/1574819_460s.jpg" VerticalAlignment="Top" ImageOpened="Image_ImageOpened"/>
</StackPanel>
</ScrollViewer>
</controls:PanoramaItem>


private void Image_ImageOpened(object sender, RoutedEventArgs e)
{
debugger.Text = "DONE";
}

最佳答案

参见 Limited Image Size在 MSDN 上。

Due to the limited screen resolution of Windows Phone, another way to optimize performance is to limit the image size to 2000 x 2000 pixels, which is the size limit of images in the Windows Phone environment. Larger images will be sampled at a lower resolution. Also, if you use images that are larger than 2000 x 2000 pixels, they will be significantly slower to appear.

If you must use images larger than 2000 x 2000 you should only display a portion of the file that meets the 2000 limit. You can do this by loading the image into a WriteableBitmap and using the LoadJpeg(WriteableBitmap, Stream) extension method.

关于c# - 图片无法在 Windows Phone 7.5 上完全加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8754527/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com