How to restore the images uploaded for imagelist control in VB 6.0

给你一囗甜甜゛ 提交于 2019-12-11 03:20:06

问题


I have a VB 6.0 application which contains some images inside a imagelist control. I want to know where these images get stored in the system.( because I want to use these images in another application and I dont have the images seperately in the system) So, the only way is to take the images from Visusal basic 6.0 project. Do we have anything like resource folder similar to .Net?

Please let me know soon.

Thanks Rupa


回答1:


  • Start an empty project.
  • Add reference (Ctrl+T) to Microsoft Windows Common Controls 5.0 or 6.0
  • Copy/Paste image list control to Form1
  • Rename image list control to ImageList1

Use this code

Dim lIdx As Long

For lIdx = 1 To ImageList1.ListImages.Count
    SavePicture ImageList1.ListImages(lIdx).Picture, "C:\TEMP\img" & lIdx & ".bmp"
Next



回答2:


I ran across the same problem some time ago. I ended up writing a small function in the form with the imagelist that "manually" saved each image in the imagelist to disk.




回答3:


' utility to save images from a VB6 imagelist - example ExtractVB6ImageListImages(ImageListModes,"ImageListModes")
Function ExtractVB6ImageListImages(myimagelist As ImageList, listname As String)
    Dim nCount As Integer
    Dim nIndex As Integer
    Dim sKey As String

    Dim temp As Image

    nCount = myimagelist.ListImages.count()
    For nIndex = 1 To nCount
        If nIndex < 10 Then
            SavePicture myimagelist.ListImages(nIndex).Picture, listname + "00" + Mid(Str(nIndex), 2) + ".bmp"
        ElseIf nIndex < 100 Then
            SavePicture myimagelist.ListImages(nIndex).Picture, listname + "0" + Mid(Str(nIndex), 2) + ".bmp"
        Else
            SavePicture myimagelist.ListImages(nIndex).Picture, listname + Mid(Str(nIndex), 2) + ".bmp"
        End If

    Next

End Function


来源:https://stackoverflow.com/questions/4051859/how-to-restore-the-images-uploaded-for-imagelist-control-in-vb-6-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!