public void SetRegion(IntPtr hwnd, System.Drawing.Region region) { var graphics = System.Drawing.Graphics.FromHwnd(hwnd); hRgnBlur = region.GetHrgn(graphics); dwFlags |= DWM_BB.BlurRegion; graphics.Dispose(); }
/// <summary> /// Presents the contents of the next buffer in the sequence of back buffers to the screen. /// </summary> /// <param name="flags">The flags.</param> /// <param name="sourceRectangle">The area of the back buffer that should be presented.</param> /// <param name="destinationRectangle">The area of the front buffer that should receive the result of the presentation.</param> /// <param name="windowOverride">The destination window whose client area is taken as the target for this presentation.</param> /// <param name="region">Specifies a region on the back buffer that contains the minimal amount of pixels that need to be updated.</param> /// <unmanaged>HRESULT IDirect3DSwapChain9::Present([In, Optional] const void* pSourceRect,[InOut, Optional] const void* pDestRect,[In] HWND hDestWindowOverride,[In] const RGNDATA* pDirtyRegion,[In] unsigned int dwFlags)</unmanaged> public void Present(Present flags, Rectangle sourceRectangle, Rectangle destinationRectangle, IntPtr windowOverride, System.Drawing.Region region) { unsafe { var graphics = System.Drawing.Graphics.FromHwnd(windowOverride); var regionPtr = region.GetHrgn(graphics); graphics.Dispose(); var srcPtr = IntPtr.Zero; if (sourceRectangle != Rectangle.Empty) { srcPtr = new IntPtr(&sourceRectangle); } var destPtr = IntPtr.Zero; if (destinationRectangle != Rectangle.Empty) { destPtr = new IntPtr(&destinationRectangle); } Present(srcPtr, destPtr, windowOverride, regionPtr, (int)flags); } }
public void SetRegion(System.Drawing.Graphics graphics, System.Drawing.Region region) { hRgnBlur = region.GetHrgn(graphics); dwFlags |= BlurBehindFlags.BlurRegion; }