Uwp 如何在应用程序中显示文件和文件夹的缩略图?
我正在构建一个应用程序,我想在其中显示光盘中文件和文件夹的缩略图。如何操作?一旦您有权访问文件夹(通过使用Uwp 如何在应用程序中显示文件和文件夹的缩略图?,uwp,Uwp,我正在构建一个应用程序,我想在其中显示光盘中文件和文件夹的缩略图。如何操作?一旦您有权访问文件夹(通过使用FolderPicker的用户选择或通过图片库等功能),您就可以从系统中检索缩略图。您可以使用getScaledImageAshumbnailAsync()进行此操作。例如: private async Task<BitmapImage> GetThumbnail(StorageFile file) { if (file != null) { St
FolderPicker
的用户选择或通过图片库
等功能),您就可以从系统中检索缩略图。您可以使用getScaledImageAshumbnailAsync()
进行此操作。例如:
private async Task<BitmapImage> GetThumbnail(StorageFile file)
{
if (file != null)
{
StorageItemThumbnail thumb = await file.GetScaledImageAsThumbnailAsync(ThumbnailMode.VideosView);
if (thumb != null)
{
BitmapImage img = new BitmapImage();
await img.SetSourceAsync(thumb);
return img;
}
}
return null;
}
private异步任务GetThumbnail(存储文件)
{
如果(文件!=null)
{
StorageItemThumbnail=wait file.getScaledImageAshumbnailAsync(ThumbnailMode.VideosView);
if(thumb!=null)
{
BitmapImage img=新的BitmapImage();
等待img.SetSourceAsync(拇指);
返回img;
}
}
返回null;
}
一旦您有权访问文件夹(通过使用FolderPicker
的用户选择或通过图片库
等功能),您就可以从系统中检索缩略图。您可以使用getScaledImageAshumbnailAsync()
进行此操作。例如:
private async Task<BitmapImage> GetThumbnail(StorageFile file)
{
if (file != null)
{
StorageItemThumbnail thumb = await file.GetScaledImageAsThumbnailAsync(ThumbnailMode.VideosView);
if (thumb != null)
{
BitmapImage img = new BitmapImage();
await img.SetSourceAsync(thumb);
return img;
}
}
return null;
}
private异步任务GetThumbnail(存储文件)
{
如果(文件!=null)
{
StorageItemThumbnail=wait file.getScaledImageAshumbnailAsync(ThumbnailMode.VideosView);
if(thumb!=null)
{
BitmapImage img=新的BitmapImage();
等待img.SetSourceAsync(拇指);
返回img;
}
}
返回null;
}
您好,欢迎来到StackOverflow。请回顾如何提出有关stackoverflow的好问题您好,欢迎来到stackoverflow。请回顾如何提出有关stackoverflow的好问题