vb.net - 我如何在VB中的 ListView 控件中显示视频的图像缩略图?

标签 vb.net image listview

我正在编写一个简单的基于 Windows 的应用程序,显示分割视频并在 listview 中显示缩略图。

我找到了这段代码,但从这里我需要缩略图而不是图标

Dim strFileSize As String = " "
Dim di As New IO.DirectoryInfo(SPath & "\" & FolderName)
Dim aryFi As IO.FileInfo() = di.GetFiles("*.*")
Dim fi As IO.FileInfo
For Each fi In aryFi
 Dim ico As Icon = Icon.ExtractAssociatedIcon(fi.FullName)
  ImageList1.Images.Add(ico)
  ListView1.Items.Add(fi.ToString, ImageList1.Images.Count - 1)
Next

最佳答案

您必须从 ffmpeg 中的每个视频中获取缩略图并启动该过程。我的选择是

 proc.StartInfo.FileName = System.IO.Path.Combine(Application.StartupPath, "ffmpeg.exe")
 proc.StartInfo.UseShellExecute = False
 proc.StartInfo.CreateNoWindow = True
 proc.StartInfo.WindowStyle = ProcessWindowStyle.Normal
 proc.StartInfo.RedirectStandardInput = True
 proc.EnableRaisingEvents = True
 For Each fi In aryFi
        proc.StartInfo.Arguments = " -i " + fi.FullName + " -vframes 1 " & (SPath & "\" & FolderName1 & "\") & fi.Name & "%d.jpg"
        proc.Start()
 Next

将图像添加到图像列表中并显示

For Each files In filesList
ImageList1.Images.Add(Bitmap.FromFile(files))
Next

关于vb.net - 我如何在VB中的 ListView 控件中显示视频的图像缩略图?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30705986/

相关文章:

json - 使用 Google 自定义搜索 API 获取 Google 图片中图片的 URL?

c# - ListView 中的图像与 BackColor 属性不匹配

c# - C#中如何清除 ListView 中的数据

c# - 记录错误代码的最佳方法

.net - "Keyset does not exist"将 SignData 函数与 RSA 一起使用时

.net - 我可以使用 WinForms VB.NET 应用程序访问中央服务器上的数据库吗?

javascript - 为图像上的特定区域着色

vb.net - 有没有更干净的方法来处理文本框验证事件

html - Safari 图像渲染错误

android - 带图片和文字的ListView