BitmapSource 類別

定義

提供使用點陣圖格式影像來源的屬性的來源物件。

public ref class BitmapSource : ImageSource
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.WinUIContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class BitmapSource : ImageSource
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public class BitmapSource : ImageSource
Public Class BitmapSource
Inherits ImageSource
繼承
Object Platform::Object IInspectable DependencyObject ImageSource BitmapSource
衍生
屬性

備註

Important

你通常不會直接使用或建立 BitmapSource 類型,這也是為什麼你在這個頁面上看不到程式碼範例。 比較常見的是建立一個 BitmapImage 並用它作為數值。 如需程式碼範例及更多資訊,請參閱 BitmapImage 的參考頁面。

ImageSource 和 BitmapSource 是 BitmapImage 的中介基底類別。 欲了解更多如何建立用於 Image.SourceImageBrush.ImageSource 的影像來源,請參見 Image 與 ImageBrush 以及 BitmapImage

BitmapSource 衍生類別

BitmapSource 是 BitmapImageWriteableBitmap 的父類別。

建構函式

名稱 Description
BitmapSource()

提供 BitmapSource 衍生類別的基底類別初始化行為。

屬性

名稱 Description
Dispatcher

它總是在 Windows 應用程式 SDK 應用程式中回傳 null 。 改用 DispatcherQueue

(繼承來源 DependencyObject)
DispatcherQueue

得到 DispatcherQueue 這個物件所關聯的那個。 代表 DispatcherQueue 一個功能,即使程式碼是由非 UI 執行緒發起,也能存取 UI DependencyObject 執行緒。

(繼承來源 DependencyObject)
PixelHeight

它會取得點陣圖的高度(像素單位)。

PixelHeightProperty

識別 PixelHeight 依賴屬性。

PixelWidth

會得到點陣圖的寬度(像素數)。

PixelWidthProperty

識別 PixelWidth 相依屬性。

方法

名稱 Description
ClearValue(DependencyProperty)

清除依賴性財產的局部價值。

(繼承來源 DependencyObject)
GetAnimationBaseValue(DependencyProperty)

回傳任何為相依屬性建立的基礎值,適用於動畫未啟用時。

(繼承來源 DependencyObject)
GetValue(DependencyProperty)

回傳 DependencyObject 中相依屬性的當前有效值。

(繼承來源 DependencyObject)
ReadLocalValue(DependencyProperty)

若設定了本地值,則回傳依賴性質的局部值。

(繼承來源 DependencyObject)
RegisterPropertyChangedCallback(DependencyProperty, DependencyPropertyChangedCallback)

註冊一個通知函式,用於監聽此 DependencyObject 實例中特定 DependencyProperty 的變更。

(繼承來源 DependencyObject)
SetSource(IRandomAccessStream)

透過存取串流來設定 BitmapSource 的原始影像。 大多數呼叫者應該改用 SetSourceAsync

SetSourceAsync(IRandomAccessStream)

透過存取串流並非同步處理結果,設定 BitmapSource 的原始影像。

SetValue(DependencyProperty, Object)

將相依屬性的局部值設定在 DependencyObject 上。

(繼承來源 DependencyObject)
UnregisterPropertyChangedCallback(DependencyProperty, Int64)

取消先前透過呼叫 RegisterPropertyChangedCallback 註冊的變更通知。

(繼承來源 DependencyObject)

適用於

另請參閱