开发者

Get all resources in array

I have a VB.NET program with lots of embedded resources which are images. Is there a way to get all the resources in an array so I can acces them in a for loop?

I currently have to do it this way:

 images(1) = My.Resources.image1
 images(2) = My.Resources.image2
 '...
 i开发者_运维百科mages(80) = My.Resources.image80


Something like this perhaps:

Dim ResourceSet As Resources.ResourceSet = My.Resources.ResourceManager.GetResourceSet(Globalization.CultureInfo.CurrentCulture, True, True)
For Each Dict As DictionaryEntry In ResourceSet.OfType(Of Object)()
    If TypeOf (Dict.Value) Is Drawing.Image Then
        Debug.WriteLine(Dict.Key) 'outputting resource name
       (Do stuff here)
    End If
Next

It appears that the key is the name of the resource.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜