读书人

C# bitmap.FromResource,该怎么处理

发布时间: 2011-12-31 23:50:30 作者: rapoo

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 ");
}

读书人网 >C#

热点推荐