Image.FromHbitmap Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates a Bitmap from a Windows handle.
Overloads
FromHbitmap(IntPtr) |
Creates a Bitmap from a handle to a GDI bitmap. |
FromHbitmap(IntPtr, IntPtr) |
Creates a Bitmap from a handle to a GDI bitmap and a handle to a GDI palette. |
FromHbitmap(IntPtr)
- Source:
- Image.cs
- Source:
- Image.cs
Creates a Bitmap from a handle to a GDI bitmap.
public:
static System::Drawing::Bitmap ^ FromHbitmap(IntPtr hbitmap);
public static System.Drawing.Bitmap FromHbitmap (IntPtr hbitmap);
static member FromHbitmap : nativeint -> System.Drawing.Bitmap
Public Shared Function FromHbitmap (hbitmap As IntPtr) As Bitmap
Parameters
Returns
The Bitmap this method creates.
Remarks
The FromHbitmap method makes a copy of the GDI bitmap; so you can release the incoming GDI bitmap using the GDI DeleteObject
method immediately after creating the new Image.
Applies to
FromHbitmap(IntPtr, IntPtr)
- Source:
- Image.cs
- Source:
- Image.cs
Creates a Bitmap from a handle to a GDI bitmap and a handle to a GDI palette.
public:
static System::Drawing::Bitmap ^ FromHbitmap(IntPtr hbitmap, IntPtr hpalette);
public static System.Drawing.Bitmap FromHbitmap (IntPtr hbitmap, IntPtr hpalette);
static member FromHbitmap : nativeint * nativeint -> System.Drawing.Bitmap
Public Shared Function FromHbitmap (hbitmap As IntPtr, hpalette As IntPtr) As Bitmap
Parameters
- hpalette
-
IntPtr
nativeint
A handle to a GDI palette used to define the bitmap colors if the bitmap specified in the hbitmap
parameter is not a device-independent bitmap (DIB).
Returns
The Bitmap this method creates.
Remarks
The FromHbitmap method makes a copy of the GDI bitmap; so you can release the incoming GDI bitmap using the GDI DeleteObject
method immediately after creating the new Image.