首先使用反编译工具查看程序集中的资源

091926168.png

代码如下:

Assembly myAssembly;
myAssembly = System.Reflection.Assembly.Load("SQLEditor2"); //不要加程序集扩展名
System.Resources.ResourceManager myManager = new System.Resources.ResourceManager("SQLEditor2.FrmEditor", myAssembly); //不要加.resources
var icon = (System.Drawing.Icon)myManager.GetObject("$this.Icon");
using (var f = File.Create("C:\\$this.Icon.ico"))
{
    icon.Save(f);
}
string[] bmpNames = new string[]{
                               "tsbsel.Image",
                               "toolStripButton1.Image",
                               "toolStripSplitButton1.Image"
                            };
System.Drawing.Image myImage;
foreach (string bmpName in bmpNames)
{
    myImage = (System.Drawing.Image)myManager.GetObject(bmpName);
    myImage.Save(String.Format("C:\\{0}.bmp", bmpName));
}

这样就可以得到程序集中的Icon和Bitmap了,string类型的内容直接从反编译工具中获得就可以了。