The new built had some implementation changes in order to put the Glass effect into your Form.
public partial class GlassForm : Form
{
[DllImport("dwmapi.dll")]
public static extern int DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS pMarInset);
[StructLayout(LayoutKind.Sequential)]
public class MARGINS
{
public int cxLeftWidth;
public int cxRightWidth;
public int cyTopHeight;
public int cyBottomHeight;
}
MARGINS margins;
public GlassForm()
{
InitializeComponent();
this.BackColor = Color.Black;
margins = new MARGINS();
}
private void UpdateGlass()
{
margins.cxLeftWidth = -1;
margins.cxRightWidth = -1;
margins.cyTopHeight = -1;
margins.cyBottomHeight = -1;
int result = DwmExtendFrameIntoClientArea(this.Handle, ref margins);
}
private void Form1_Load(object sender, EventArgs e)
{
UpdateGlass();
}
private void Form1_Resize(object sender, EventArgs e)
{
UpdateGlass();
}
}
The change is that now the Form’s Backcolor must be Color.Black in order for the glass to work, compare to the previous version when it possible to set any key as long as the Form.TransparentKey was the same Color.
Not sure if I like this change or not, Anyhow am not a graphics expert 