BitmapImage.DecodePixelWidth 속성

정의

이미지가 디코드되는 너비(픽셀)를 가져오거나 설정합니다.

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

속성 값

Int32

이미지가 디코드되는 너비(픽셀)입니다. 기본값은 0입니다.

예제

다음 코드 예제에서는 설정 하는 방법에 설명 합니다 DecodePixelWidth 코드를 사용 하 여 속성입니다.

// 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)

설명

경우 DecodePixelHeight 비트맵의 가로 세로 비율 무시 됩니다 설정 이기도 합니다. 경우 DecodePixelHeight 가로 세로 비율을 동일 하 게 유지를 설정 하지 않으면.

JPEG 및 PNG(이식 가능한 네트워크 그래픽) 코덱은 기본적으로 이미지를 지정된 크기로 디코딩합니다. 다른 코덱은 이미지를 원래 크기로 디코딩하고 원하는 크기로 이미지 크기를 조정합니다.

종속성 속성 정보

식별자 필드 DecodePixelWidthProperty
메타 데이터 속성 설정 true 없음

적용 대상

추가 정보