は、 画像の高さと幅の問題は、私はWindowsの携帯電話に新しいです7
は今だけ、スタックパネルで画像を表示しようとするサンプルをしています。イメージを実際の高さと幅で表示したいとします。実際の高さと幅は0を返します。
実際に高さ360ピクセル、幅480ピクセルの画像です。
以下に私のコードを掲示しました。 Plsヘルプ。
ありがとうございました。
MaingPage.xaml
<Grid x:Name="LayoutRoot" Background="Transparent">
<StackPanel Name="imagePanel" ></StackPanel>
</Grid>
MainPage.xaml.cs
namespace ImageResizing
{
public partial class MainPage : PhoneApplicationPage
{
Image myImage;
BitmapImage bit;
// Constructor
public MainPage()
{
InitializeComponent();
myImage = new Image();
Uri uri = new Uri("Penguins.jpg", UriKind.Relative);
bit = new BitmapImage(uri);
myImage.Source = bit;
myImage.Width = myImage.ActualWidth; // Returns 0
myImage.Height = myImage.ActualHeight; // Returns 0
myImage.Width = bit.PixelWidth; // Also tried this. It returns 0 too
myImage.Height = bit.PixelHeight; // Also tried this. It returns 0 too
myImage.Stretch = Stretch.Fill;
imagePanel.Children.Add(myImage);
}
}
}
uが言ったように私は、コードを再配置しました。しかし、高さと幅は0を返します。上記のコードをチェックしてください。 – Arun
このサイト:http://www.i-programmer.info/programming/wpf-workings/520-bitmapimage-and-local-files-.html?start=1あなたが見ているものに関連する詳細をいくつか持っているかもしれません? –