/// <summary> /// Creates an Image object from the specified file. /// </summary> /// <param name="file"></param> /// <returns></returns> public System.Drawing.Image LoadImage(string file) { int hDC = 0; System.Drawing.Image img; System.IntPtr hBitmap; hBitmap = DevILAPI.ilutWinLoadImage(System.Runtime.InteropServices.Marshal.StringToCoTaskMemAnsi(file), hDC); img = System.Drawing.Image.FromHbitmap(hBitmap); GDI.DeleteObject(hBitmap); return(img); }
/// <summary> /// Creates a Win32 bitmap (hBitmap) from the specified file. /// </summary> /// <param name="file">image location</param> /// <returns>Hbitmap</returns> public System.IntPtr LoadHBitmap(string file) { int hDC = 0; return(DevILAPI.ilutWinLoadImage(System.Runtime.InteropServices.Marshal.StringToCoTaskMemAnsi(file), hDC)); }