BitmapCreateOptions 列舉

定義

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

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

C#
[System.Flags]
public enum BitmapCreateOptions
繼承
BitmapCreateOptions
屬性

欄位

DelayCreation 2

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

IgnoreColorProfile 4

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

IgnoreImageCache 8

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

None 0

不指定 BitmapCreateOptions。 這是預設值。

PreservePixelFormat 1

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

範例

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

C#
// 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);

備註

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

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

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

適用於

產品 版本
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
Windows Desktop 3.0, 3.1, 5, 6, 7

另請參閱