Example #1
0
    public Plexiglass(IOU_Helper.Form1 tocover)
    {
        _form1 = tocover;
        InitializeComponent();

        //this.DoubleBuffered = true;
        this.TransparencyKey       = Color.Turquoise;
        this.BackColor             = Color.Turquoise;
        this.Opacity               = 0.9; // Tweak as desired
        this.FormBorderStyle       = FormBorderStyle.None;
        this.ControlBox            = false;
        this.ShowInTaskbar         = false;
        this.StartPosition         = FormStartPosition.Manual;
        this.AutoScaleMode         = AutoScaleMode.None;
        this.Location              = tocover.PointToScreen(Point.Empty);
        this.ClientSize            = tocover.ClientSize;
        tocover.LocationChanged   += Cover_LocationChanged;
        tocover.ClientSizeChanged += Cover_ClientSizeChanged;
        this.Show(tocover);
        tocover.Focus();
        // Disable Aero transitions, the plexiglass gets too visible
        if (Environment.OSVersion.Version.Major >= 6)
        {
            int value = 1;
            DwmSetWindowAttribute(tocover.Handle, DWMWA_TRANSITIONS_FORCEDISABLED, ref value, 4);
        }
    }