Beispiel #1
0
        static TabStripCloseButton()
        {
            ColorHLS hls = new ColorHLS(SystemColors.Highlight);
            hls.Lighten(0.3f);
            hls.Alpha = 150;

            _HighLightColor = hls.Color;
        }
        public void DrawGlyph(Graphics gfx)
        {
            if (_IsMouseOver)
            {
                ColorHLS hls = new ColorHLS(SystemColors.Highlight);
                hls.Lighten(0.3f);
                hls.Alpha = 150;

                gfx.FillRectangle(new SolidBrush(hls.Color), glyphRect);

                Rectangle borderRect = glyphRect;

                borderRect.Width--;
                borderRect.Height--;

                gfx.DrawRectangle(SystemPens.Highlight, borderRect);
            }

            SmoothingMode bak = gfx.SmoothingMode;

            gfx.SmoothingMode = SmoothingMode.Default;

            using (Pen pen = new Pen(Color.Black))
            {
                pen.Width = 2;

                gfx.DrawLine(pen, new Point(glyphRect.Left + (glyphRect.Width / 3) - 2, glyphRect.Height / 2-1),
                    new Point(glyphRect.Right - (glyphRect.Width / 3), glyphRect.Height / 2-1));
            }

            gfx.FillPolygon(Brushes.Black, new Point[]{
                new Point(glyphRect.Left + (glyphRect.Width / 3)-2, glyphRect.Height / 2+2),
                new Point(glyphRect.Right - (glyphRect.Width / 3), glyphRect.Height / 2+2),
                new Point(glyphRect.Left + glyphRect.Width / 2-1,glyphRect.Bottom-4)});

            gfx.SmoothingMode = bak;
        }