BitmapImage.DecodePixelHeight Egenskap
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Hämtar eller anger den höjd, i bildpunkter, som bilden avkodas till.
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
Egenskapsvärde
Höjden, i bildpunkter, som bilden avkodas till. Standardvärdet är 0.
Exempel
Följande kodexempel visar hur du DecodePixelHeight anger egenskapen med hjälp av kod.
// 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)
Kommentarer
Om DecodePixelWidth anges också ignoreras proportioner i bitmappen. Om DecodePixelWidth inte har angetts förblir proportionerna desamma.
PNG-koderna (JPEG och Portable Network Graphics) avkodar bilden till den angivna storleken. andra codecs avkodar bilden i dess ursprungliga storlek och skalar bilden till önskad storlek.
Information om beroendeegenskap
| Objekt | Value |
|---|---|
| Identifierarfält | DecodePixelHeightProperty |
Metadataegenskaper inställda på true |
Ingen |