BitmapImage.DecodePixelHeight Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Obtém ou define a altura, em píxeis, para a qual a imagem é decodificada.
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
Valor de Propriedade
A altura, em pixels, para a qual a imagem é decodificada. O valor padrão é 0.
Exemplos
O exemplo de código seguinte demonstra como definir a DecodePixelHeight propriedade usando código.
// 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)
Observações
Se DecodePixelWidth também for definido, a proporção de aspeto do bitmap é ignorada. Se DecodePixelWidth não estiver definido, a proporção mantém-se a mesma.
Os codecs JPEG e Portable Network Graphics (PNG) decodificam nativamente a imagem para o tamanho especificado; outros codecs decodificam a imagem no seu tamanho original e escalam a imagem para o tamanho desejado.
Informação de Propriedade de Dependência
| Número | Value |
|---|---|
| Campo identificador | DecodePixelHeightProperty |
Propriedades dos metadados definidas como true |
None |