1

如何知道拾取图像的大小,或如何限制拾取图像,例如图像的最大大小为 1 MB,这是我的代码

   var openPicker = new Windows.Storage.Pickers.FileOpenPicker();
        openPicker.ViewMode = Windows.Storage.Pickers.PickerViewMode.Thumbnail;
        openPicker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.DocumentsLibrary;
        openPicker.FileTypeFilter.Add(".png");
        openPicker.FileTypeFilter.Add(".Jpeg");
        openPicker.FileTypeFilter.Add(".Jpg");

        StorageFile file = await openPicker.PickSingleFileAsync();
4

1 回答 1

1

不幸的是,没有办法提前限制拾取文件的大小。

选择文件后,您可以调用http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.storagefile.getbasicpropertiesasync.aspx以获取其大小。

于 2012-12-08T13:10:44.597 回答