日期:2014-05-19  浏览次数:20861 次

C# bitmap.FromResource
public   static   Bitmap   FromResource   (
IntPtr   hinstance,
string   bitmapName
)
具体如何用?举例.

------解决方案--------------------
//假设temp.dll中有名称为ResourceName的位图资源,这就可以通过:
using System.Runtime.InteropServices;

[DllImport( "kernel32.dll ")]
internal static extern IntPtr LoadLibrary(string lpLibFileName);
private void button1_Click(object sender, EventArgs ce)
{
IntPtr vLibraryHandle = LoadLibrary(@ "c:\temp\temp.dll ");
pictureBox1.Image = Bitmap.FromResource(vLibraryHandle, "ResourceName ");
}