Developer, Former MVP, now at Microsoft - Best of 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
namespace GlassMoth{ public class Form2 : System.Windows.Forms.Form { public Form2() { this.ClientSize = new System.Drawing.Size(200, 200); System.IntPtr hr = CreateEllipticRgn(30, 30, 170, 170); //or CreateRectRgn DWM_BLURBEHIND dbb; dbb.fEnable = true; dbb.dwFlags = 1 2; dbb.hRgnBlur = hr; dbb.fTransitionOnMaximized = false; DwmEnableBlurBehindWindow(this.Handle, ref dbb); } protected override void OnPaintBackground( System.Windows.Forms.PaintEventArgs e) { e.Graphics.FillRectangle( new System.Drawing.SolidBrush(System.Drawing.Color.Black), new System.Drawing.Rectangle(30, 30, 140, 140)); } #region pinvokes [System.Runtime.InteropServices.DllImport("gdi32")] private static extern System.IntPtr CreateEllipticRgn( int nLeftRect, int nTopRect, int nRightRect, int nBottomRect); public struct DWM_BLURBEHIND { public int dwFlags; public bool fEnable; public System.IntPtr hRgnBlur;//HRGN public bool fTransitionOnMaximized; } [System.Runtime.InteropServices.DllImport("dwmapi")] private static extern int DwmEnableBlurBehindWindow( System.IntPtr hWnd, ref DWM_BLURBEHIND pBlurBehind); #endregion }}