开发者

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

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.( bec开发者_Python百科ause 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


  • 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


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.


' 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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜