BitmapImage.DecodePixelWidth 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 bredden i bildpunkter som bilden avkodas till.
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
Egenskapsvärde
Bredden i bildpunkter som bilden avkodas till. Standardvärdet är 0.
Exempel
Följande kodexempel visar hur du DecodePixelWidth 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 DecodePixelHeight anges också ignoreras proportioner i bitmappen. Om DecodePixelHeight 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 | DecodePixelWidthProperty |
Metadataegenskaper inställda på true |
Ingen |