BitmapCreateOptions 列舉

定義

指定點陣圖影像的初始設定選項。

此列舉支援其成員值的位元組合。

public enum class BitmapCreateOptions
[System.Flags]
public enum BitmapCreateOptions
[<System.Flags>]
type BitmapCreateOptions = 
Public Enum BitmapCreateOptions
繼承
BitmapCreateOptions
屬性

欄位

DelayCreation 2

造成 BitmapSource 物件延遲初始設定,直到必要時才開始進行。 處理影像集合時,這會很實用。

IgnoreColorProfile 4

造成 BitmapSource 忽略內嵌色彩設定檔。

IgnoreImageCache 8

載入影像時未使用現有的影像快取。 只有在快取中的影像需要重新整理時,才應該選取此選項。

None 0

不指定 BitmapCreateOptions。 這是預設值。

PreservePixelFormat 1

確保儲存和載入檔案所用的 PixelFormat 相同。

範例

下列範例示範如何具現化 BitmapImage 和 指定 BitmapCreateOptions 列舉值。

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

備註

如果未 PreservePixelFormat 設定, PixelFormat 系統會根據系統決定的內容來選擇映射的 ,以產生最佳效能。 啟用此選項會保留檔案格式,但可能會導致效能降低。

如果 IgnoreColorProfile 已設定,則呼叫 之類的 CopyPixels(Array, Int32, Int32) 方法不會傳回色彩更正的位。

如果 IgnoreImageCache 已設定,即使它們共用相同的 Uri ,仍會取代映射快取中的任何現有專案。

適用於

另請參閱