BExplorer.Shell.Interop.ShellThumbnail.GetBitmapFromHBitmap C# (CSharp) Method

GetBitmapFromHBitmap() public method

public GetBitmapFromHBitmap ( IntPtr nativeHBitmap ) : Bitmap
nativeHBitmap System.IntPtr
return System.Drawing.Bitmap
        public Bitmap GetBitmapFromHBitmap(IntPtr nativeHBitmap)
        {
            Bitmap bmp = Bitmap.FromHbitmap(nativeHBitmap);

            if (Bitmap.GetPixelFormatSize(bmp.PixelFormat) < 32) return bmp;

            BitmapData bmpData;

            if (IsAlphaBitmap(bmp, out bmpData))
            {
                Bitmap resBmp = GetlAlphaBitmapFromBitmapData(bmpData);
                bmpData = null;
                return resBmp;
            }

            bmpData = null;
            return bmp;
        }
        #endregion