2010-10-29 28 views
2

我有一個VB 6.0應用程序,其中包含一些imagelist內的圖像列表控件。我想知道這些圖像在系統中的存儲位置(因爲我想在另一個應用程序中使用這些圖像,並且我沒有在系統中單獨顯示這些圖像)所以,唯一的方法是將圖像從Visusal basic 6.0項目。 我們是否有類似.Net的資源文件夾?如何恢復上傳的圖像列表控件在VB 6.0中的圖像

請讓我知道很快。

感謝 魯帕

回答

6
  • 開始一個空的項目。
  • Microsoft Windows Common Controls 5.0 or 6.0
  • 複製/粘貼圖像列表控制到Form1
  • 重命名圖像列表控制添加參考(按Ctrl + T)來ImageList1

使用此代碼

Dim lIdx As Long 

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

+1,您可以將此代碼臨時粘貼到您的真實項目中。你甚至可以從立即窗口運行它。 – MarkJ 2010-11-01 16:20:19

1

我碰到了同樣的問題前一段時間跑了。我最終在圖像列表中用手動方式將圖像列表中的每個圖像保存到磁盤中。

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

與1年前發佈的接受答案几乎相同 – MarkJ 2012-02-01 17:14:43