Yes, I've given two examples, first one that works, and loads file from disk, and the other one that must work, but is not.
First one is to help people like me who were without idea how to load at all, for first help, yet the second one is here as an idea, to expand by the ones who know better than me.
The second example must work in WPF enviroment by loading file that is in your resurces folder (you create folder, click add existing file (the one you have copied there, in this case icon_32.png), and in properties of the file, set "resources" (not Embeded, not compiled, or...)
so, in your WPF app you will see folder "resources" and inside file icon_32.png
Ok
And now you should be able to load it by converting URI to stream. The first thing is to create URI, then convert it to stream, and then hopefully to system.drawings.icon. But, converting it to stream is not working by using the most simple URI
Dim iconUri As Uri = New Uri("pack://application:,,,/resources/icon_32.png")
. At least in my case, it may work in yours. I suspect one should use URI in form of
pack://application:,,,/ReferencedAssembly;component/ResourceFile.xaml where assembly must by your .dll because maybe WPF is trying to find file in autocad, not in this assembly (not in your .net autocad add-on). However, as I have said, I stopped here, and... if anyone knows, it would be nice to know this and add this code to some repository of standard routines.