Created
March 26, 2011 08:16
-
-
Save painejake/888126 to your computer and use it in GitHub Desktop.
Code thats placed in the main form
This file contains 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
/// <summary> | |
/// Code to apply the Aero effect to the Window. | |
/// Set all the four value -1 to apply glass effect to the whole window | |
/// Set custom value to make specific part of the window glassy | |
/// Color.DarkKhaki sets the form Aero trigger due to a bug in VS2010 where some other colors allow click through | |
/// </summary> | |
/// <param name="sender"></param> | |
/// <param name="e"></param> | |
private void MainForm_Load(object sender, EventArgs e) | |
{ | |
try | |
{ | |
{ | |
AeroGlass.WindowsAero margins = new AeroGlass.WindowsAero(); | |
margins.cxLeftWidth = -1; | |
margins.cxRightWidth = -1; | |
margins.cyTopHeight = -1; | |
margins.cyButtomheight = -1; | |
IntPtr hwnd = this.Handle; | |
int result = AeroGlass.DwmExtendFrameIntoClientArea(hwnd, ref margins); | |
this.BackColor = Color.DarkKhaki; | |
} | |
} | |
catch (System.Exception) | |
{ | |
/// Here we default back to the original color if Aero cannot be enabled. | |
/// Such as if the user is running Windows XP or Vista/7 Basic | |
this.BackColor = DefaultBackColor; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment