예제 #1
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            Bitmap   B = new Bitmap(Width, Height);
            Graphics G = Graphics.FromImage(B);

            Rectangle mainTop    = new Rectangle(0, 0, Width - 1, 40);
            Rectangle mainBottom = new Rectangle(0, 40, Width, Height);

            base.OnPaint(e);


            G.Clear(Color.Fuchsia);
            G.SetClip(Draw.RoundRect(new Rectangle(0, 0, Width, Height), 9));

            SolidBrush gradientBackground = new SolidBrush(Color.FromArgb(34, 34, 34));

            G.FillRectangle(gradientBackground, mainBottom);

            LinearGradientBrush gradientBackground2 = new LinearGradientBrush(mainTop, Color.FromArgb(23, 23, 23), Color.FromArgb(17, 17, 17), 90);

            G.FillRectangle(gradientBackground2, mainTop);

            G.DrawLine(new Pen(new SolidBrush(Color.FromArgb(56, 56, 56))), 0, 40, Width - 1, 40);
            G.DrawLine(new Pen(new SolidBrush(Color.FromArgb(42, 42, 42))), 0, 41, Width - 1, 41);

            G.DrawRectangle(new Pen(new SolidBrush(Color.FromArgb(12, 12, 12))), new Rectangle(0, 0, Width - 1, Height - 1));

            Font drawFont = new Font("Calibri (Body)", 15, FontStyle.Bold);

            G.DrawString(Parent.FindForm().Text, drawFont, new SolidBrush(Color.FromArgb(225, 225, 225)), 3, 18);

            e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0);
            G.Dispose();
            B.Dispose();
        }
예제 #2
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            Bitmap    B = new Bitmap(Width, Height);
            Graphics  G = Graphics.FromImage(B);
            Rectangle ClientRectangle = new Rectangle(0, 0, Width - 1, Height - 1);
            Rectangle InnerRectangle  = new Rectangle(1, 1, Width - 3, Height - 3);

            base.OnPaint(e);

            G.Clear(BackColor);
            Font drawFont = new Font("Calibri (Body)", 10, FontStyle.Bold);

            G.SmoothingMode = SmoothingMode.HighQuality;

            switch (ColorScheme)
            {
            case ColorSchemes.DarkGray:
                LinearGradientBrush gradientBackground = new LinearGradientBrush(ClientRectangle, Color.FromArgb(23, 23, 23), Color.FromArgb(17, 17, 17), 90);
                G.FillPath(gradientBackground, Draw.RoundRect(ClientRectangle, 4));

                Pen p = new Pen(new SolidBrush(Color.FromArgb(56, 56, 56)));
                G.DrawPath(p, Draw.RoundRect(ClientRectangle, 4));

                Pen p2 = new Pen(new SolidBrush(Color.FromArgb(5, 240, 240, 240)));
                G.DrawPath(p2, Draw.RoundRect(InnerRectangle, 4));
                break;

            case ColorSchemes.Green:
                LinearGradientBrush gradientBackground1 = new LinearGradientBrush(ClientRectangle, Color.FromArgb(121, 185, 0), Color.FromArgb(94, 165, 1), 90);
                G.FillPath(gradientBackground1, Draw.RoundRect(ClientRectangle, 4));

                Pen p1 = new Pen(new SolidBrush(Color.FromArgb(159, 207, 1)));
                G.DrawPath(p1, Draw.RoundRect(ClientRectangle, 4));

                Pen p21 = new Pen(new SolidBrush(Color.FromArgb(30, 240, 240, 240)));
                G.DrawPath(p21, Draw.RoundRect(InnerRectangle, 4));
                break;

            case ColorSchemes.Blue:
                LinearGradientBrush gradientBackground2 = new LinearGradientBrush(ClientRectangle, Color.FromArgb(0, 124, 186), Color.FromArgb(0, 97, 166), 90);
                G.FillPath(gradientBackground2, Draw.RoundRect(ClientRectangle, 4));

                Pen p22 = new Pen(new SolidBrush(Color.FromArgb(0, 161, 207)));
                G.DrawPath(p22, Draw.RoundRect(ClientRectangle, 4));

                Pen p220 = new Pen(new SolidBrush(Color.FromArgb(10, 240, 240, 240)));
                G.DrawPath(p220, Draw.RoundRect(InnerRectangle, 4));
                break;

            case ColorSchemes.White:
                LinearGradientBrush gradientBackground22 = new LinearGradientBrush(ClientRectangle, Color.FromArgb(245, 245, 245), Color.FromArgb(246, 246, 246), 90);
                G.FillPath(gradientBackground22, Draw.RoundRect(ClientRectangle, 4));

                Pen p221 = new Pen(new SolidBrush(Color.FromArgb(254, 254, 254)));
                G.DrawPath(p221, Draw.RoundRect(ClientRectangle, 4));

                Pen p223 = new Pen(new SolidBrush(Color.FromArgb(10, 240, 240, 240)));
                G.DrawPath(p223, Draw.RoundRect(InnerRectangle, 4));
                break;

            case ColorSchemes.Red:
                LinearGradientBrush gradientBackground3 = new LinearGradientBrush(ClientRectangle, Color.FromArgb(185, 0, 0), Color.FromArgb(170, 0, 0), 90);
                G.FillPath(gradientBackground3, Draw.RoundRect(ClientRectangle, 4));

                Pen p3 = new Pen(new SolidBrush(Color.FromArgb(209, 1, 1)));
                G.DrawPath(p3, Draw.RoundRect(ClientRectangle, 4));

                Pen p23 = new Pen(new SolidBrush(Color.FromArgb(2, 240, 240, 240)));
                G.DrawPath(p23, Draw.RoundRect(InnerRectangle, 4));
                break;

            default:

                break;
            }

            switch (State)
            {
            case MouseState.None:
                if (ColorScheme == ColorSchemes.White)
                {
                    G.DrawString(Text, drawFont, new SolidBrush(Color.FromArgb(51, 51, 51)), new Rectangle(0, 1, Width - 1, Height - 1), new StringFormat
                    {
                        Alignment     = StringAlignment.Center,
                        LineAlignment = StringAlignment.Center
                    });
                }
                else
                {
                    LinearGradientBrush textGradient = new LinearGradientBrush(ClientRectangle, Color.FromArgb(235, 235, 235), Color.FromArgb(212, 212, 212), 90);
                    G.DrawString(Text, drawFont, textGradient, new Rectangle(0, 1, Width - 1, Height - 1), new StringFormat
                    {
                        Alignment     = StringAlignment.Center,
                        LineAlignment = StringAlignment.Center
                    });
                }
                break;

            case MouseState.Over:
                G.DrawString(Text, drawFont, new SolidBrush(Color.Silver), new Rectangle(0, 1, Width - 1, Height - 1), new StringFormat
                {
                    Alignment     = StringAlignment.Center,
                    LineAlignment = StringAlignment.Center
                });
                break;

            case MouseState.Down:
                G.DrawString(Text, drawFont, new SolidBrush(Color.DimGray), new Rectangle(0, 1, Width - 1, Height - 1), new StringFormat
                {
                    Alignment     = StringAlignment.Center,
                    LineAlignment = StringAlignment.Center
                });
                break;
            }


            e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0);
            G.Dispose();
            B.Dispose();
        }
예제 #3
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            Bitmap   B = new Bitmap(Width, Height);
            Graphics G = Graphics.FromImage(B);

            G.SmoothingMode = SmoothingMode.HighQuality;

            int intValue = Convert.ToInt32(_Value / _Maximum * Width);

            G.Clear(BackColor);


            G.DrawPath(new Pen(new SolidBrush(Color.FromArgb(26, 26, 26))), Draw.RoundRect(new Rectangle(1, 1, Width - 3, Height - 3), 2));

            SolidBrush percentColor = new SolidBrush(Color.White);

            ////// Bar Fill
            if (!(intValue == 0))
            {
                switch (ColorScheme)
                {
                case ColorSchemes.DarkGray:
                    LinearGradientBrush g1 = new LinearGradientBrush(new Rectangle(2, 2, intValue - 5, Height - 5), Color.FromArgb(23, 23, 23), Color.FromArgb(17, 17, 17), 90);
                    G.FillPath(g1, Draw.RoundRect(new Rectangle(2, 2, intValue - 5, Height - 5), 2));
                    percentColor = new SolidBrush(Color.White);
                    break;

                case ColorSchemes.Green:
                    LinearGradientBrush g11 = new LinearGradientBrush(new Rectangle(2, 2, intValue - 5, Height - 5), Color.FromArgb(121, 185, 0), Color.FromArgb(94, 165, 1), 90);
                    G.FillPath(g11, Draw.RoundRect(new Rectangle(2, 2, intValue - 5, Height - 5), 2));
                    percentColor = new SolidBrush(Color.White);
                    break;

                case ColorSchemes.Blue:
                    LinearGradientBrush g12 = new LinearGradientBrush(new Rectangle(2, 2, intValue - 5, Height - 5), Color.FromArgb(0, 124, 186), Color.FromArgb(0, 97, 166), 90);
                    G.FillPath(g12, Draw.RoundRect(new Rectangle(2, 2, intValue - 5, Height - 5), 2));
                    percentColor = new SolidBrush(Color.White);
                    break;

                case ColorSchemes.White:
                    LinearGradientBrush g13 = new LinearGradientBrush(new Rectangle(2, 2, intValue - 5, Height - 5), Color.FromArgb(245, 245, 245), Color.FromArgb(246, 246, 246), 90);
                    G.FillPath(g13, Draw.RoundRect(new Rectangle(2, 2, intValue - 5, Height - 5), 2));
                    percentColor = new SolidBrush(Color.FromArgb(20, 20, 20));
                    break;

                case ColorSchemes.Red:
                    LinearGradientBrush g14 = new LinearGradientBrush(new Rectangle(2, 2, intValue - 5, Height - 5), Color.FromArgb(185, 0, 0), Color.FromArgb(170, 0, 0), 90);
                    G.FillPath(g14, Draw.RoundRect(new Rectangle(2, 2, intValue - 5, Height - 5), 2));
                    percentColor = new SolidBrush(Color.White);
                    break;
                }
            }

            ////// Outer Rectangle
            G.DrawPath(new Pen(Color.FromArgb(190, 56, 56, 56)), Draw.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2));

            ////// Bar Size
            G.DrawPath(new Pen(Color.FromArgb(150, 97, 94, 90)), Draw.RoundRect(new Rectangle(2, 2, intValue - 5, Height - 5), 2));

            if (_ShowPercentage)
            {
                G.DrawString(Convert.ToString(string.Concat(Value, "%")), new Font("Tahoma", 9, FontStyle.Bold), percentColor, new Rectangle(0, 1, Width - 1, Height - 1), new StringFormat
                {
                    Alignment     = StringAlignment.Center,
                    LineAlignment = StringAlignment.Center
                });
            }

            e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0);
            G.Dispose();
            B.Dispose();
        }
예제 #4
0
        protected override void OnPaint(PaintEventArgs e)
        {
            Bitmap   B = new Bitmap(Width, Height);
            Graphics G = Graphics.FromImage(B);

            base.OnPaint(e);

            try
            {
                SelectedTab.BackColor = mainBackground;
            }
            catch
            {
            }

            G.Clear(topBackground);
            G.SmoothingMode = SmoothingMode.HighQuality;

            switch (ColorScheme)
            {
            case ColorSchemes.DarkGray:
                activeTabColor = Color.FromArgb(10, 10, 10);
                _textColor     = Color.White;
                break;

            case ColorSchemes.Green:
                activeTabColor = Color.FromArgb(94, 165, 1);
                _textColor     = Color.White;
                break;

            case ColorSchemes.Blue:
                activeTabColor = Color.FromArgb(0, 97, 166);
                _textColor     = Color.White;
                break;

            case ColorSchemes.White:
                activeTabColor = Color.FromArgb(245, 245, 245);
                _textColor     = Color.FromArgb(36, 36, 36);
                break;

            case ColorSchemes.Red:
                activeTabColor = Color.FromArgb(170, 0, 0);
                _textColor     = Color.White;
                break;
            }

            for (int i = 0; i <= TabPages.Count - 1; i++)
            {
                Rectangle TabRect = new Rectangle(GetTabRect(i).X + 3, GetTabRect(i).Y, GetTabRect(i).Width - 5, GetTabRect(i).Height);
                G.FillRectangle(new SolidBrush(mainBackground), TabRect);
                G.DrawString(TabPages[i].Text, new Font("Tahoma", 9, FontStyle.Bold), new SolidBrush(ForeColor), TabRect, new StringFormat
                {
                    LineAlignment = StringAlignment.Center,
                    Alignment     = StringAlignment.Center
                });
            }

            G.FillRectangle(new SolidBrush(mainBackground), 0, ItemSize.Height, Width, Height);

            if (!(SelectedIndex == -1))
            {
                Rectangle TabRect = new Rectangle(GetTabRect(SelectedIndex).X + 3, GetTabRect(SelectedIndex).Y, GetTabRect(SelectedIndex).Width - 5, GetTabRect(SelectedIndex).Height);
                G.FillPath(new SolidBrush(activeTabColor), Draw.RoundRect(TabRect, 4));
                G.DrawPath(new Pen(new SolidBrush(Color.FromArgb(20, 20, 20))), Draw.RoundRect(TabRect, 4));
                G.DrawString(TabPages[SelectedIndex].Text, new Font("Tahoma", 9, FontStyle.Bold), new SolidBrush(_textColor), TabRect, new StringFormat
                {
                    Alignment     = StringAlignment.Center,
                    LineAlignment = StringAlignment.Center
                });
            }

            e.Graphics.DrawImage(B, new Point(0, 0));
            G.Dispose();
            B.Dispose();
        }