Ejemplo n.º 1
0
        public static void ExtendFrameIntoClientArea(this Form form, Control glassArea)
        {
            if (IsGlassSupported)
            {
                if (glassArea.Dock != DockStyle.Top)
                {
                    glassArea.Dock = DockStyle.Top;
                    glassArea.SendToBack();
                }
                glassArea.BackColor = Color.Transparent;
                glassArea.Resize += delegate(object sender, EventArgs e)
                {
                    form.Invalidate(glassArea.Region, true);
                };

                form.Paint += delegate(object sender, PaintEventArgs e)
                {
                    using (SolidBrush blackBrush = new SolidBrush(Color.Black))
                    {
                        e.Graphics.FillRectangle(blackBrush, glassArea.ClientRectangle);
                    }
                };

                MARGINS marg;
                marg.Top = glassArea.Height;
                marg.Left = 0;
                marg.Right = 0;
                marg.Bottom = 0;
                DwmExtendFrameIntoClientArea(form.Handle, ref marg);

                glassArea.SetGlassWindowDragable();
            }
        }