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 に答える