我不理解这个错误,当我将文件添加到我的Listviwe同时从所选文件中添加一个函数extarct图标并将extarced图标添加到图像列表但是当我选择了15个以上的文件时错误的消息出现了 "无效参数=值' 15'对于StateImageIndex'。"
无效这是我的代码:
Dim ofg As New OpenFileDialog
Dim lvp As New ListViewItem
ofg.Multiselect = True
ofg.Filter = "All Files|*.*"
If ofg.ShowDialog = Windows.Forms.DialogResult.OK Then
For Each File As String In ofg.FileNames
Dim hInst As IntPtr = Marshal.GetHINSTANCE([Assembly].GetExecutingAssembly.GetModules()(0))
Dim iIcon As Int32 = 0
Dim hIcon As IntPtr
hIcon = ExtractAssociatedIcon(hInst, File, iIcon)
ico = Icon.FromHandle(hIcon)
icondufile = ico.ToBitmap
Img.Images.Add(icondufile)
Dim C_File As New IO.FileInfo(File)
Dim ItemFile As ListViewItem = New ListViewItem(C_File.Name)
lvp = Files_List.Items.Add(ItemFile)
lvp.SubItems.Add(MD5Checksum(File))
lvp.SubItems.Add(hash_generator("sha1", File))
lvp.SubItems.Add(hash_generator("sha256", File))
lvp.SubItems.Add(GetCRC32(File))
lvp.SubItems.Add(hash_generator("sha384", File))
lvp.SubItems.Add(hash_generator("sha512", File))
lvp.SubItems.Add(C_File.FullName)
lvp.SubItems.Add(C_File.Extension)
Dim Index As Integer
lvp.StateImageIndex = lvp.Index 'The error comes from here
ItemFile = Nothing
Next
答案 0 :(得分:0)
根据文件:
虽然
StateImageList
属性中指定的ImageList可以包含任意数量的图像,并且StateImageIndex
属性可以设置为等于或小于14的任何值,但只有索引位置0处的图像和1显示为状态图像。
那么你想用StateImageList
属性做什么?为什么要将其设置为大于14的值?