AeroLib

An extensive C# library for manipulating the DWM (Desktop Window Manager) on Windows Vista and Windows 7.

Surround a control with Aero Glass

Surround a control named SurroundedPanel with Aero Glass.

Note: The background of a region needs to be black for Aero Glass to expand into it.

                    
                        BackColor = Color.Black;
                        Window.AeroSurroundControl(this, SurroundedPanel);
                    
                

Fill a form with Aero Glass

Fill a form's entire client area with Aero Glass.

Note: The background of a region needs to be black for Aero Glass to expand into it.

                    
                        BackColor = Color.Black;
                        SurroundedPanel.BackColor = Color.Transparent;
                        Window.AeroFill(this);
                    
                

Retract Aero Glass

Remove expanded Aero Glass from a form.

Also reset the background color now that the black is no longer needed.

                    
                        BackColor = SystemColors.Control;
                        SurroundedPanel.BackColor = Color.Transparent;
                        Window.AeroRetract(this);
                    
                

Get the Aero Glass color

Get the primary color of the Aero Glass, if it exists and show it in a message box.

                    
                        // Get the Aero Glass color
                        var aeroColor = Desktop.AeroColor;

                        // Check if the color exists, which might not be the case 
                        // if on an older system or when using the Classic theme
                        if(aeroColor != null)            
                            MessageBox.Show("The Aero Glass color is: " + Desktop.AeroColor);
                        else
                            MessageBox.Show("Aero is not enabled.");
                    
                

Set the Aero Glass color

Set the primary color of the Aero Glass effect from a System.Windows.Forms.ColorDialog named ColorDialog.

                    
                        // Get the Aero Glass color
                        var aeroColor = Desktop.AeroColor;

                        // Check if the color exists, which might not be the case 
                        // if on an older system or when using the Classic theme
                        if(aeroColor != null)
                        {
                            // Set the color dialog to match the 
                            // current color
                            ColorDialog.Color = aeroColor.Value;

                            if (ColorDialog.ShowDialog() == DialogResult.OK)
                                Desktop.AeroColor = ColorDialog.Color;
                        }