BExplorer.Shell.Interop.Gdi32.NativeDraw C# (CSharp) Метод

NativeDraw() публичный статический Метод

public static NativeDraw ( IntPtr destDC, IntPtr hBitmap, int x, int y, int iconSize, System.Boolean isHidden = false ) : void
destDC System.IntPtr
hBitmap System.IntPtr
x int
y int
iconSize int
isHidden System.Boolean
Результат void
		public static void NativeDraw(IntPtr destDC, IntPtr hBitmap, int x, int y, int iconSize, Boolean isHidden = false) {
			IntPtr destCDC = CreateCompatibleDC(destDC);
			IntPtr oldSource = SelectObject(destCDC, hBitmap);
			AlphaBlend(destDC, x, y, iconSize, iconSize, destCDC, 0, 0, iconSize, iconSize, new BLENDFUNCTION(AC_SRC_OVER, 0, (byte)(isHidden ? 0x7f : 0xff), AC_SRC_ALPHA));
			SelectObject(destCDC, oldSource);
			DeleteObject(destCDC);
			DeleteObject(oldSource);
			DeleteObject(hBitmap);
		}

Same methods

Gdi32::NativeDraw ( IntPtr destDC, IntPtr hBitmap, int x, int y, int iconSizeWidth, int iconSizeHeight, System.Boolean isHidden = false ) : void
Gdi32::NativeDraw ( IntPtr destDC, IntPtr hBitmap, int x, int y, int iconSizeWidth, int iconSizeHeight, int iconSizeWidthDest, int iconSizeHeightDest, System.Boolean isHidden = false ) : void

Usage Example

Пример #1
0
        public HResult ExtractAndDrawThumbnail(IntPtr hdc, uint iconSize, out WTS_CACHEFLAGS flags, User32.RECT iconBounds, out bool retrieved, bool isHidden, bool isRefresh = false)
        {
            HResult       res = HResult.S_OK;
            ISharedBitmap bmp = null;

            flags = WTS_CACHEFLAGS.WTS_DEFAULT;
            WTS_THUMBNAILID thumbId = new WTS_THUMBNAILID();

            try
            {
                retrieved = false;
                res       = ThumbnailCache.GetThumbnail(this._Item.ComInterface, iconSize, isRefresh ? (WTS_FLAGS.WTS_FORCEEXTRACTION | WTS_FLAGS.WTS_SCALETOREQUESTEDSIZE) : (WTS_FLAGS.WTS_INCACHEONLY | WTS_FLAGS.WTS_SCALETOREQUESTEDSIZE), out bmp, flags, thumbId);
                IntPtr hBitmap = IntPtr.Zero;
                if (bmp != null)
                {
                    bmp.GetSharedBitmap(out hBitmap);
                    retrieved = true;

                    int width;
                    int height;
                    Gdi32.ConvertPixelByPixel(hBitmap, out width, out height);
                    Gdi32.NativeDraw(hdc, hBitmap, iconBounds.Left + (iconBounds.Right - iconBounds.Left - width) / 2, iconBounds.Top + (iconBounds.Bottom - iconBounds.Top - height) / 2, width, height, isHidden);
                    Gdi32.DeleteObject(hBitmap);
                }
            }
            finally
            {
                if (bmp != null)
                {
                    Marshal.ReleaseComObject(bmp);
                }
            }
            return(res);
        }