Exemplo n.º 1
0
        private void fMain_Paint(object sender, PaintEventArgs e)
        {
            if (GlassText.IsCompositionEnabled())
            {
                e.Graphics.Clear(Color.Black);
                Rectangle clientArea = new Rectangle(0, pnlTop.Height, this.ClientRectangle.Width, this.ClientRectangle.Height - pnlTop.Height);
                Brush     b          = new SolidBrush(this.BackColor);
                e.Graphics.FillRectangle(b, clientArea);

                GlassText glasstxt = new GlassText();
                glasstxt.FillBlackRegion(pnlTop.CreateGraphics(), pnlTop.ClientRectangle);
                glasstxt.DrawTextOnGlass(pnlTop.Handle, lblAppTitle.Text, lblAppTitle.Font, lblAppTitle.Bounds, 5);
            }
        }
Exemplo n.º 2
0
        public void ExtendGlassFrameToControl(Control control)
        {
            if (Glass.IsDesktopCompositionEnabled())
            {
                var clientBounds = this.RectangleToScreen(this.ClientRectangle);
                var rect         = control.RectangleToScreen(control.ClientRectangle);
                rect.Offset(-clientBounds.X, -clientBounds.Y);

                var margins = new Glass.MARGINS()
                {
                    Left   = rect.Left,
                    Right  = this.ClientRectangle.Width - rect.Right,
                    Top    = rect.Top,
                    Bottom = this.ClientRectangle.Height - rect.Bottom
                };
                ExtendGlassFrameIntoClientArea(margins);

                this.Paint += (sender2, e2) =>
                {
                    var glasstxt = new GlassText();
                    glasstxt.FillBlackRegion(e2.Graphics, this.ClientRectangle);
                };
            }
        }