public void UpdateBackgroundGraphics(byte opacity) { POINT dstPos = new POINT(Left, Top); SIZE dstSize = new SIZE(Width, Height); POINT srcPos = POINT.Empty; BLENDFUNCTION blend = new BLENDFUNCTION(BlendOp.AC_SRC_OVER, opacity, AlphaFormat.AC_SRC_ALPHA); if (!NativeMethods.UpdateLayeredWindow(new HandleRef(this, Handle), new HandleRef(this, hdcScreen), ref dstPos, ref dstSize, new HandleRef(this, hdcBackground), ref srcPos, new COLORREF(), ref blend, UlwFlags.ULW_ALPHA)) throw new Win32Exception(); }
public static extern bool UpdateLayeredWindow(HandleRef hwnd, HandleRef hdcDst, [In] ref POINT pptDst, [In] ref SIZE psize, HandleRef hdcSrc, [In] ref POINT pptSrc, COLORREF crKey, [In] ref BLENDFUNCTION pblend, UlwFlags dwFlags);