Created
September 16, 2014 10:50
-
-
Save margusmartsepp/a1fd8b1940bdbed9a106 to your computer and use it in GitHub Desktop.
Win 7 glass background
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [DllImport("gdi32")] | |
| private static extern IntPtr CreateEllipticRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect); | |
| [DllImport("dwmapi")] | |
| private static extern int DwmEnableBlurBehindWindow(IntPtr hWnd, ref DwmBlurbehind pBlurBehind); | |
| public struct DwmBlurbehind | |
| { | |
| public int DwFlags; | |
| public bool FEnable; | |
| public IntPtr HRgnBlur; | |
| public bool FTransitionOnMaximized; | |
| } | |
| public Form1() | |
| { | |
| InitializeComponent(); | |
| } | |
| private void Form1_Load(object sender, EventArgs e) | |
| { | |
| var hr = CreateEllipticRgn(0, 0, Width, Height); | |
| var dbb = new DwmBlurbehind {FEnable = true, DwFlags = 1, HRgnBlur = hr, FTransitionOnMaximized = false}; | |
| DwmEnableBlurBehindWindow(Handle, ref dbb); | |
| } | |
| protected override void OnPaint(PaintEventArgs e) | |
| { | |
| e.Graphics.FillRectangle(new SolidBrush(Color.Black), new Rectangle(0, 0, Width, Height)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment