Windows phone 7 全景图是从孤立存储中缩小的背景图片
我有一个简单的网页与全景和一个按钮,必须改变全景的背景图片。原来图片是1200x800。 如果我使用参考资料中的图片,一切正常:Windows phone 7 全景图是从孤立存储中缩小的背景图片,windows-phone-7,panorama-control,Windows Phone 7,Panorama Control,我有一个简单的网页与全景和一个按钮,必须改变全景的背景图片。原来图片是1200x800。 如果我使用参考资料中的图片,一切正常: Uri uri = new Uri("Resources/Panorama.png", UriKind.Relative); var bitmap2 = new BitmapImage(uri); // here from debugging: bitmap2.CreateOptions == DelayCreation, bitmap2.PixelWidth ==
Uri uri = new Uri("Resources/Panorama.png", UriKind.Relative);
var bitmap2 = new BitmapImage(uri);
// here from debugging: bitmap2.CreateOptions == DelayCreation, bitmap2.PixelWidth == 0 and bitmap2.PixelHeight == 0
var lcBrush2 = new ImageBrush() {
Stretch = Stretch.Fill,
ImageSource = bitmap2
};
panoMain.Background = lcBrush2;
但如果我从独立存储中拍摄照片:
var picStream = ...getting a stream of file....;
BitmapImage bitmap = new BitmapImage();
bitmap.SetSource(picStream);
// here from debugging: bitmap.PixelWidth == 1200 and bitmap.PixelHeight == 800
var lcBrush = new ImageBrush() {
Stretch = Stretch.Fill,
ImageSource = bitmap
};
panoMain.Background = lcBrush;
然后图片缩小到480x800
我做错了什么?或者是MS的错误?看起来像。该线程的一个解决方法:
我发现的一个解决方法是在图像中设置一个“默认”背景图像
具有所需大小的XAML。如果我这样做,那么更新
“我的主页上加载的事件”中的背景属性新图像显示为
与默认图像大小相同
在该线程的底部还有另一种解决方法,使用代码。该线程的一个解决方法:
我发现的一个解决方法是在图像中设置一个“默认”背景图像
具有所需大小的XAML。如果我这样做,那么更新
“我的主页上加载的事件”中的背景属性新图像显示为
与默认图像大小相同
在该线程的底部还有另一种解决方法,使用代码。通过从文件加载资源,可以使用相同的笔刷加载代码吗?您可能需要将资源的属性设置为CopyToOutput是否可以使用bitmap=new BitmapImage(uri);在这两段代码中,我都想,但是如何获得具有Uri的独立存储?当涉及WP7的UI时,请也包括XAML代码,这可以说很多。您可以通过从文件加载资源来使用相同的刷子加载代码吗?您可能需要将资源的属性设置为CopyToOutput是否可以使用bitmap=new BitmapImage(uri);在这两段代码中,我都想,但是如何获得具有Uri的独立存储?当涉及WP7的UI时,请同时包含XAML代码,这可以说明很多。@factorSystemic-在AppHub升级中,以前的链接似乎已被删除。这是更新的链接@FactorMystic-在AppHub升级中,以前的链接似乎已被删除。这是最新的链接