Bitmap.FromResource Method

Creates a Bitmap from the specified Windows resource.

Namespace: System.Drawing
Assembly: System.Drawing (in system.drawing.dll)

public static Bitmap FromResource (
	IntPtr hinstance,
	string bitmapName
public static Bitmap FromResource (
	IntPtr hinstance, 
	String bitmapName
public static function FromResource (
	hinstance : IntPtr, 
	bitmapName : String
) : Bitmap
Not applicable.



A handle to an instance of the executable file that contains the resource.


A string containing the name of the resource bitmap.

Return Value

The Bitmap that this method creates.

FromResource requires security permission to call unmanaged code. For a managed alternative for creating a bitmap from an embedded resource, see System.Drawing.Bitmap(Type,String). FromResource works only with bitmaps that are named resources in a DLL.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions