使用添加到TreeView VBA中的ImageList的新图像的问题

时间:2017-07-18 19:21:23

标签: vba access-vba

我无法使用以编程方式放入图像列表的新图像。所有旧图像都可以正常工作我想在TreeView中使用的新图像是Comment.bmp。

Public Sub loadImageList()

il_ForTreeview.ListImages.Clear

il_ForTreeview.ImageHeight = sldr_treeSize.Value
il_ForTreeview.ImageWidth = sldr_treeSize.Value

    With il_ForTreeview.ListImages
       .Add , "IntermediateEvent", LoadPicture(Application.CurrentProject.Path & "\icons\IntermediateEvent.bmp")
       .Add , "Outcome", LoadPicture(Application.CurrentProject.Path & "\icons\Outcome.bmp")
       .Add , "EndState", LoadPicture(Application.CurrentProject.Path & "\icons\EndState.bmp")
       .Add , "Comment", LoadPicture(Application.CurrentProject.Path & "\icons\Comment.bmp")
   End With

End Sub

现在,只要节点的ID_Type为2,就应该将其图像设置为Comment.bmp。

Private Sub addChildren(tv As TreeView, nodParent As Node, rsReqs As DAO.Recordset, lngParentID As Long)
   ...
      Set nodX = tv.Nodes.Add(nodParent, tvwChild, genReqNodeID(rsReqs!PK_Main), Left(rsReqs!mem_Req, 200)) 
      Select Case rsReqs!ID_Types
         Case 1 'Head
            nodX.Image = "Head"
         Case 2 'Comment
            nodX.Image = "Comment"
         Case 3 'IntermediateEvent
            nodX.Image = "IntermediateEvent"      
         Case 4 'EndState
            nodX.Image = "EndState"      
      End Select
      ...
   Loop
End Sub

我的图标文件夹中肯定有Comment.bmp文件。问题似乎是程序没有识别新图像的名称,因为如果我将新文件更改为其他名称之一,例如" EndState"图像加载得很好。微软访问是否缓存旧图像列表?

我得到的错误是

frm_Phases Form_Current 35601 Element not found

0 个答案:

没有答案