DeviceThumbnail 類別

定義

代表裝置的縮圖影像。

public ref class DeviceThumbnail sealed : IClosable, IRandomAccessStreamWithContentType
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class DeviceThumbnail final : IClosable, IRandomAccessStreamWithContentType
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class DeviceThumbnail : System.IDisposable, IRandomAccessStreamWithContentType
Public NotInheritable Class DeviceThumbnail
Implements IDisposable, IRandomAccessStreamWithContentType
繼承
Object Platform::Object IInspectable DeviceThumbnail
屬性
實作

Windows 需求

裝置系列
Windows 10 (已於 10.0.10240.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)

範例

// Takes a parameter of type DeviceInformation
// and retrieves a DeviceThumbnail to pass to displayImage().
function getImage (device) {   

    var thumbnail = null;
    if (device){
        device.getThumbnailAsync().then(
            function (thumbnail) {
                if (thumbnail){      
                    if (thumbnail.size > 0) {
                        displayImage(thumbnail);
                    }                                                                      
                 }     
             });
    }                                                                                     
}

function displayImage(imageFile) {

    try {
        // Setting 2nd parameter to 'false' cleans up 
        // the URL after first use.
        // We set this because we only need to load the URL
        // into the image tag once.
        document.getElementById("deviceImage").src = 
            window.URL.createObjectURL(imageFile, false);
    } catch (e) {
        document.getElementById("statusMessage").innerHTML = 
            "Could not display image, error: " + e.message;
    }

}

備註

呼叫 DeviceInformation.GetThumbnailAsync 並處理完成事件,如範例所示。

屬性

CanRead

取得值,這個值表示是否可以讀取資料流程。

CanWrite

取得值,這個值表示是否可以寫入資料流程。

ContentType

傳回縮圖影像的內容類型。

Position

取得資料流程的位元組位移。

Size

取得或設定裝置縮圖影像的大小。

方法

CloneStream()

在與目前資料流程相同的資源上,建立 IRandomAccessStream 的新實例。

Close()

關閉目前的資料流程,並釋放系統資源。

Dispose()

執行與釋放 (Free)、釋放 (Release) 或重設 Unmanaged 資源相關聯之應用程式定義的工作。

FlushAsync()

在循序資料流程中以非同步方式排清資料。

GetInputStreamAt(UInt64)

傳回從指定位置開始之輸入資料流程的指標。

GetOutputStreamAt(UInt64)

傳回從指定位置開始之輸出資料流程的指標。

ReadAsync(IBuffer, UInt32, InputStreamOptions)

傳回非同步位元組讀取器物件。

Seek(UInt64)

將資料流程的位置設定為指定的值。

WriteAsync(IBuffer)

以非同步方式在循序資料流程中寫入資料。

適用於