BitmapImage.DecodePixelHeight プロパティ

定義

イメージがデコードされる高さ (ピクセル単位) を取得または設定します。

public:
 property int DecodePixelHeight { int get(); void set(int value); };
public int DecodePixelHeight { get; set; }
member this.DecodePixelHeight : int with get, set
Public Property DecodePixelHeight As Integer

プロパティ値

イメージがデコードされる高さ (ピクセル単位)。 既定値は 0 です。

次のコード例では、コードを使用して プロパティを設定する DecodePixelHeight 方法を示します。

// Define a BitmapImage.
Image myImage = new Image();
BitmapImage bi = new BitmapImage();

// Begin initialization.
bi.BeginInit();

// Set properties.
bi.CacheOption = BitmapCacheOption.OnDemand;
bi.CreateOptions = BitmapCreateOptions.DelayCreation;
bi.DecodePixelHeight = 125;
bi.DecodePixelWidth = 125;
bi.Rotation = Rotation.Rotate90;
MessageBox.Show(bi.IsDownloading.ToString());
bi.UriSource = new Uri("smiley.png", UriKind.Relative);

// End initialization.
bi.EndInit();
myImage.Source = bi;
myImage.Stretch = Stretch.None;
myImage.Margin = new Thickness(5);
' Define a BitmapImage.
Dim myImage As New Image()
Dim bi As New BitmapImage()

' Begin initialization.
bi.BeginInit()

' Set properties.
bi.CacheOption = BitmapCacheOption.OnDemand
bi.CreateOptions = BitmapCreateOptions.DelayCreation
bi.DecodePixelHeight = 125
bi.DecodePixelWidth = 125
bi.Rotation = Rotation.Rotate90
MessageBox.Show(bi.IsDownloading.ToString())
bi.UriSource = New Uri("smiley.png", UriKind.Relative)

' End initialization.
bi.EndInit()
myImage.Source = bi
myImage.Stretch = Stretch.None
myImage.Margin = New Thickness(5)

注釈

も設定されている場合 DecodePixelWidth 、ビットマップの縦横比は無視されます。 が設定されていない場合 DecodePixelWidth 、縦横比は変わりません。

JPEG およびポータブル ネットワーク グラフィックス (PNG) コーデックは、イメージを指定したサイズにネイティブにデコードします。他のコーデックでは、イメージを元のサイズでデコードし、イメージを目的のサイズにスケーリングします。

依存プロパティ情報

識別子フィールド DecodePixelHeightProperty
に設定されたメタデータ プロパティ true なし

適用対象

こちらもご覧ください