Ejemplo n.º 1
0
 private void AeroLabel_Paint(object sender, PaintEventArgs e)
 {
     if (null != ctr)
     {
         GlassText gt = new GlassText();
         //gt.FillBlackRegion(ctr.CreateGraphics(), this.ClientRectangle);
         //Brush b = Brushes.Transparent;
         //e.Graphics.Clear(Color.Transparent);
         //e.Graphics.FillRectangle(b, this.Bounds);
         gt.DrawTextOnGlass(ctr.Handle, this.Text, this.Font, this.Bounds, 10);
     }
 }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
0
        // Toggle border only
        private void toggleBordersOnly(bool state)
        {
            pnlTop.Height           = state ? 0 : 22;
            statusStripMain.Visible = !state;

            GlassText.MARGINS mg = new GlassText.MARGINS();
            mg.m_Buttom = 0; mg.m_Left = 0; mg.m_Right = 0; mg.m_Top = pnlTop.Height;
            GlassText.DwmExtendFrameIntoClientArea(this.Handle, ref mg);
            this.Invalidate();

            // Remove borders
            if (state)
            {
                this.noBorderFullSize = this.Size;
            }
            this.FormBorderStyle = state ? FormBorderStyle.FixedSingle : FormBorderStyle.Sizable;
            this.Size            = this.noBorderFullSize;
        }
Ejemplo n.º 4
0
        public fMain()
        {
            InitializeComponent();

            // Aero trick
            if (GlassText.IsCompositionEnabled())
            {
                pnlTop.BackColor     = Color.Black;
                lblAppTitle.Location = new Point(-5, -5); lblAppTitle.Visible = false;
                GlassText.MARGINS mg = new GlassText.MARGINS();
                mg.m_Buttom = 0; mg.m_Left = 0; mg.m_Right = 0; mg.m_Top = pnlTop.Height;
                GlassText.DwmExtendFrameIntoClientArea(this.Handle, ref mg);
            }

            // MouseLeave trick
            ptOnWinTimer.Tick    += new EventHandler(ptOnWinTimer_Tick);
            ptOnWinTimer.Interval = 50;
            //ptOnWinTimer.Enabled = true;
        }
Ejemplo n.º 5
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);
                };
            }
        }