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);


            base.OnPaint(e);

            G.Clear(BackColor);
            Font drawFont = new Font("Verdana", 8, FontStyle.Regular);

            G.SmoothingMode = SmoothingMode.HighQuality;

            Color[] c = new Color[] {
                Color.FromArgb(20, 20, 20),
                Color.FromArgb(45, 45, 45),
                Color.FromArgb(40, 40, 40),
                Color.FromArgb(45, 45, 45),
                Color.FromArgb(46, 46, 46),
                Color.FromArgb(47, 47, 47),
                Color.FromArgb(48, 48, 48),
                Color.FromArgb(49, 49, 49),
                Color.FromArgb(50, 50, 50)
            };
            G.FillRectangle(new SolidBrush(Color.FromArgb(50, 50, 50)), ClientRectangle);
            Draw.InnerGlow(G, ClientRectangle, c);

            switch (_HeaderLine)
            {
            case HeaderLine.Enabled:
                G.DrawLine(new Pen(new SolidBrush(Color.FromArgb(45, 45, 45))), 16, 29, Width - 17, 29);
                G.DrawLine(new Pen(new SolidBrush(Color.FromArgb(20, 20, 20))), 15, 30, Width - 16, 30);
                G.DrawLine(new Pen(new SolidBrush(Color.FromArgb(45, 45, 45))), 16, 31, Width - 17, 31);
                break;

            case HeaderLine.Disabled:
                break;
            }

            G.DrawString(Text, drawFont, Brushes.Silver, new Rectangle(0, 3, Width - 1, 27), new StringFormat
            {
                Alignment     = StringAlignment.Center,
                LineAlignment = StringAlignment.Center
            });


            e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0);
            G.Dispose();
            B.Dispose();
        }
Ejemplo n.º 2
0
        protected override void OnPaint(PaintEventArgs e)
        {
            Bitmap   B  = new Bitmap(Width, Height);
            Graphics G  = Graphics.FromImage(B);
            Font     FF = new Font("Verdana", 8, FontStyle.Regular);

            try
            {
                SelectedTab.BackColor = Color.FromArgb(50, 50, 50);
            }
            catch
            {
            }
            G.Clear(Parent.FindForm().BackColor);

            G.FillRectangle(new SolidBrush(Color.FromArgb(50, 50, 50)), new Rectangle(0, 0, ItemSize.Height + 3, Height - 1));
            //Full Tab Background

            for (int i = 0; i <= TabCount - 1; i++)
            {
                if (i == SelectedIndex)
                {
                    Rectangle  x2      = new Rectangle(new Point(GetTabRect(i).Location.X - 2, GetTabRect(i).Location.Y - 2), new Size(GetTabRect(i).Width + 3, GetTabRect(i).Height - 1));
                    ColorBlend myBlend = new ColorBlend();
                    myBlend.Colors = new Color[] {
                        Color.FromArgb(50, 50, 50),
                        Color.FromArgb(50, 50, 50),
                        Color.FromArgb(50, 50, 50)
                    };
                    //Full Tab Background Gradient Accents
                    myBlend.Positions = new float[] {
                        0f,
                        0.5f,
                        1f
                    };
                    LinearGradientBrush lgBrush = new LinearGradientBrush(x2, Color.Black, Color.Black, 90f);
                    lgBrush.InterpolationColors = myBlend;
                    G.FillRectangle(lgBrush, x2);
                    //G.DrawRectangle(New Pen(Color.FromArgb(20, 20, 20)), x2) 'Full Tab Highlight Outline
                    Rectangle tabRect = new Rectangle(GetTabRect(i).Location.X + 4, GetTabRect(i).Location.Y + 2, GetTabRect(i).Size.Width + 10, GetTabRect(i).Size.Height - 11);
                    G.FillPath(new SolidBrush(Color.FromArgb(50, 50, 50)), RoundRect(tabRect, 4));
                    //Highlight Fill Background

                    Color[] cFull = new Color[] {
                        Color.FromArgb(20, 20, 20),
                        Color.FromArgb(40, 40, 40),
                        Color.FromArgb(45, 45, 45),
                        Color.FromArgb(46, 46, 46),
                        Color.FromArgb(47, 47, 47),
                        Color.FromArgb(48, 48, 48),
                        Color.FromArgb(49, 49, 49),
                        Color.FromArgb(50, 50, 50)
                    };
                    Draw.InnerGlow(G, new Rectangle(0, 0, ItemSize.Height + 3, Height - 1), cFull);
                    // Main Left Box Outline

                    Color[] cHighlight = new Color[] {
                        Color.FromArgb(20, 20, 20),
                        Color.FromArgb(40, 40, 40),
                        Color.FromArgb(45, 45, 45),
                        Color.FromArgb(46, 46, 46),
                        Color.FromArgb(47, 47, 47),
                        Color.FromArgb(48, 48, 48),
                        Color.FromArgb(49, 49, 49),
                        Color.FromArgb(50, 50, 50)
                    };
                    Draw.InnerGlowRounded(G, tabRect, 4, cHighlight);
                    // Fill HighLight Inner

                    G.SmoothingMode = SmoothingMode.HighQuality;
                    //Dim p() As Point = {New Point(ItemSize.Height - 3, GetTabRect(i).Location.Y + 20), New Point(ItemSize.Height + 4, GetTabRect(i).Location.Y + 14), New Point(ItemSize.Height + 4, GetTabRect(i).Location.Y + 27)}
                    //G.FillPolygon(Brushes.White, p)

                    if (ImageList != null)
                    {
                        try
                        {
                            if (ImageList.Images[TabPages[i].ImageIndex] != null)
                            {
                                G.DrawImage(ImageList.Images[TabPages[i].ImageIndex], new Point(x2.Location.X + 8, x2.Location.Y + 6));
                                G.DrawString("      " + TabPages[i].Text.ToUpper(), new Font(Font.FontFamily, Font.Size, FontStyle.Regular), Brushes.White, new Rectangle(x2.X, x2.Y - 1, x2.Width, x2.Height), new StringFormat
                                {
                                    LineAlignment = StringAlignment.Center,
                                    Alignment     = StringAlignment.Center
                                });
                            }
                            else
                            {
                                G.DrawString(TabPages[i].Text, FF, Brushes.White, new Rectangle(x2.X, x2.Y - 1, x2.Width, x2.Height), new StringFormat
                                {
                                    LineAlignment = StringAlignment.Center,
                                    Alignment     = StringAlignment.Center
                                });
                            }
                        }
                        catch (Exception ex)
                        {
                            G.DrawString(TabPages[i].Text, FF, Brushes.White, new Rectangle(x2.X, x2.Y - 1, x2.Width, x2.Height), new StringFormat
                            {
                                LineAlignment = StringAlignment.Center,
                                Alignment     = StringAlignment.Center
                            });
                        }
                    }
                    else
                    {
                        G.DrawString(TabPages[i].Text, FF, Brushes.White, new Rectangle(x2.X, x2.Y - 1, x2.Width, x2.Height), new StringFormat
                        {
                            LineAlignment = StringAlignment.Center,
                            Alignment     = StringAlignment.Center
                        });
                    }

                    G.DrawLine(new Pen(Color.FromArgb(96, 110, 121)), new Point(x2.Location.X - 1, x2.Location.Y - 1), new Point(x2.Location.X, x2.Location.Y));
                    G.DrawLine(new Pen(Color.FromArgb(96, 110, 121)), new Point(x2.Location.X - 1, x2.Bottom - 1), new Point(x2.Location.X, x2.Bottom));
                }
                else
                {
                    Rectangle x2 = new Rectangle(new Point(GetTabRect(i).Location.X - 2, GetTabRect(i).Location.Y - 2), new Size(GetTabRect(i).Width + 3, GetTabRect(i).Height + 1));
                    //G.FillRectangle(New SolidBrush(Color.FromArgb(50, 50, 50)), x2) 'Tab Highlight
                    G.DrawLine(new Pen(Color.FromArgb(96, 110, 121)), new Point(x2.Right, x2.Top), new Point(x2.Right, x2.Bottom));
                    if (ImageList != null)
                    {
                        try
                        {
                            if (ImageList.Images[TabPages[i].ImageIndex] != null)
                            {
                                G.DrawImage(ImageList.Images[TabPages[i].ImageIndex], new Point(x2.Location.X + 8, x2.Location.Y + 6));
                                G.DrawString("      " + TabPages[i].Text, Font, Brushes.White, new Rectangle(x2.X, x2.Y - 1, x2.Width, x2.Height), new StringFormat
                                {
                                    LineAlignment = StringAlignment.Near,
                                    Alignment     = StringAlignment.Near
                                });
                            }
                            else
                            {
                                G.DrawString(TabPages[i].Text, FF, new SolidBrush(Color.FromArgb(210, 220, 230)), new Rectangle(x2.X, x2.Y - 1, x2.Width, x2.Height), new StringFormat
                                {
                                    LineAlignment = StringAlignment.Center,
                                    Alignment     = StringAlignment.Center
                                });
                            }
                        }
                        catch (Exception ex)
                        {
                            G.DrawString(TabPages[i].Text, FF, new SolidBrush(Color.FromArgb(210, 220, 230)), new Rectangle(x2.X, x2.Y - 1, x2.Width, x2.Height), new StringFormat
                            {
                                LineAlignment = StringAlignment.Center,
                                Alignment     = StringAlignment.Center
                            });
                        }
                    }
                    else
                    {
                        G.DrawString(TabPages[i].Text, FF, new SolidBrush(Color.FromArgb(210, 220, 230)), new Rectangle(x2.X, x2.Y - 1, x2.Width, x2.Height), new StringFormat
                        {
                            LineAlignment = StringAlignment.Center,
                            Alignment     = StringAlignment.Center
                        });
                    }
                }
                G.FillRectangle(new SolidBrush(Color.FromArgb(50, 50, 50)), new Rectangle(86, -1, Width - 86, Height + 1));
                //Page Fill Full

                Color[] c = new Color[] {
                    Color.FromArgb(20, 20, 20),
                    Color.FromArgb(40, 40, 40),
                    Color.FromArgb(45, 45, 45),
                    Color.FromArgb(46, 46, 46),
                    Color.FromArgb(47, 47, 47),
                    Color.FromArgb(48, 48, 48),
                    Color.FromArgb(49, 49, 49),
                    Color.FromArgb(50, 50, 50)
                };
                Draw.InnerGlowRounded(G, new Rectangle(86, 0, Width - 87, Height - 1), 3, c);
                // Fill Page
            }

            G.DrawRectangle(new Pen(new SolidBrush(Color.FromArgb(50, 50, 50))), new Rectangle(0, 0, ItemSize.Height + 4, Height - 1));
            //Full Tab Outer Outline
            G.DrawRectangle(new Pen(new SolidBrush(Color.FromArgb(20, 20, 20))), new Rectangle(1, 0, ItemSize.Height + 3, Height - 2));
            //Full Tab Inner Outline

            e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0);
            G.Dispose();
            B.Dispose();
        }
Ejemplo n.º 3
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            Graphics G = e.Graphics;

            Rectangle mainRect = new Rectangle(0, 0, Width, Height);

            base.OnPaint(e);


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

            Color[] c = new Color[] {
                Color.FromArgb(10, 10, 10),
                Color.FromArgb(45, 45, 45),
                Color.FromArgb(40, 40, 40),
                Color.FromArgb(45, 45, 45),
                Color.FromArgb(46, 46, 46),
                Color.FromArgb(47, 47, 47),
                Color.FromArgb(48, 48, 48),
                Color.FromArgb(49, 49, 49),
                Color.FromArgb(50, 50, 50)
            };
            G.FillRectangle(new SolidBrush(Color.FromArgb(50, 50, 50)), mainRect);
            Draw.InnerGlow(G, mainRect, c);

            Color[] c2 = new Color[] {
                Color.FromArgb(5, 5, 5),
                Color.FromArgb(40, 40, 40),
                Color.FromArgb(41, 41, 41),
                Color.FromArgb(42, 42, 42),
                Color.FromArgb(43, 43, 43),
                Color.FromArgb(44, 44, 44),
                Color.FromArgb(45, 45, 45)
            };
            G.FillRectangle(new SolidBrush(Color.FromArgb(45, 45, 45)), new Rectangle(0, 35, Width, 23));
            Draw.InnerGlow(G, new Rectangle(0, 35, Width, 23), c2);

            LinearGradientBrush accentGradient = new LinearGradientBrush(new Rectangle(0, 36, 11, 21), _accentColor, Color.FromArgb((_accentColor.R >= 10 ? _accentColor.R - 10 : _accentColor.R + 10), (_accentColor.G >= 10 ? _accentColor.G - 10 : _accentColor.G + 10), (_accentColor.B >= 10 ? _accentColor.B - 10 : _accentColor.B + 10)), 90);

            G.FillRectangle(accentGradient, new Rectangle(0, 36, 11, 21));
            G.DrawRectangle(new Pen(new SolidBrush(Color.FromArgb(5, 5, 5))), new Rectangle(0, 35, 11, 22));
            G.FillRectangle(accentGradient, new Rectangle(Width - 12, 36, 11, 21));
            G.DrawRectangle(new Pen(new SolidBrush(Color.FromArgb(5, 5, 5))), new Rectangle(Width - 12, 35, 11, 22));

            LinearGradientBrush gloss = new LinearGradientBrush(new Rectangle(1, 0, Width - 1, 35 / 2), Color.FromArgb(255, Color.FromArgb(90, 90, 90)), Color.FromArgb(255, 71, 71, 71), 90);

            G.FillRectangle(gloss, new Rectangle(1, 0, Width - 2, 35 / 2));

            G.DrawLine(new Pen(new SolidBrush(Color.FromArgb(5, 5, 5))), 0, 0, Width, 0);
            G.DrawLine(new Pen(new SolidBrush(Color.FromArgb(150, 150, 150))), 1, 1, Width - 2, 1);
            G.DrawLine(new Pen(new SolidBrush(Color.FromArgb(85, 85, 85))), 1, 34, Width - 2, 34);
            G.DrawLine(new Pen(new SolidBrush(Color.FromArgb(45, 45, 45))), 1, 58, Width - 2, 58);

            Font drawFont = new Font("Verdana", 10, FontStyle.Regular);

            G.DrawString(Text, drawFont, new SolidBrush(Color.FromArgb(225, 225, 225)), new Rectangle(0, 0, Width, 35), new StringFormat
            {
                Alignment     = StringAlignment.Center,
                LineAlignment = StringAlignment.Center
            });

            Font subFont = new Font("Verdana", 8, FontStyle.Regular);

            G.DrawString(_subHeader, subFont, new SolidBrush(Color.FromArgb(225, 225, 225)), new Rectangle(0, 35, Width, 23), new StringFormat
            {
                Alignment     = StringAlignment.Center,
                LineAlignment = StringAlignment.Center
            });

            Font controlFont = new Font("Marlett", 10, FontStyle.Regular);

            switch (State)
            {
            case MouseState.None:
                G.DrawString("r", controlFont, new SolidBrush(Color.FromArgb(178, 178, 178)), new Rectangle(-4, -6, Width, 35), new StringFormat
                {
                    Alignment     = StringAlignment.Far,
                    LineAlignment = StringAlignment.Center
                });
                G.DrawString("1", controlFont, new SolidBrush(Color.FromArgb(178, 178, 178)), new Rectangle(-21, -5, Width, 35), new StringFormat
                {
                    Alignment     = StringAlignment.Far,
                    LineAlignment = StringAlignment.Center
                });
                G.DrawString("0", controlFont, new SolidBrush(Color.FromArgb(178, 178, 178)), new Rectangle(-38, -6, Width, 35), new StringFormat
                {
                    Alignment     = StringAlignment.Far,
                    LineAlignment = StringAlignment.Center
                });
                break;

            case MouseState.Over:
                if (X > Width - 18 & X < Width - 10 & Y < 18 & Y > 8)
                {
                    G.DrawString("r", controlFont, new SolidBrush(Color.FromArgb(255, 255, 255)), new Rectangle(-4, -6, Width, 35), new StringFormat
                    {
                        Alignment     = StringAlignment.Far,
                        LineAlignment = StringAlignment.Center
                    });
                    G.DrawString("1", controlFont, new SolidBrush(Color.FromArgb(178, 178, 178)), new Rectangle(-21, -5, Width, 35), new StringFormat
                    {
                        Alignment     = StringAlignment.Far,
                        LineAlignment = StringAlignment.Center
                    });
                    G.DrawString("0", controlFont, new SolidBrush(Color.FromArgb(178, 178, 178)), new Rectangle(-38, -6, Width, 35), new StringFormat
                    {
                        Alignment     = StringAlignment.Far,
                        LineAlignment = StringAlignment.Center
                    });
                }
                else if (X > Width - 36 & X < Width - 25 & Y < 18 & Y > 8)
                {
                    G.DrawString("r", controlFont, new SolidBrush(Color.FromArgb(178, 178, 178)), new Rectangle(-4, -6, Width, 35), new StringFormat
                    {
                        Alignment     = StringAlignment.Far,
                        LineAlignment = StringAlignment.Center
                    });
                    G.DrawString("1", controlFont, new SolidBrush(Color.FromArgb(255, 255, 255)), new Rectangle(-21, -5, Width, 35), new StringFormat
                    {
                        Alignment     = StringAlignment.Far,
                        LineAlignment = StringAlignment.Center
                    });
                    G.DrawString("0", controlFont, new SolidBrush(Color.FromArgb(178, 178, 178)), new Rectangle(-38, -6, Width, 35), new StringFormat
                    {
                        Alignment     = StringAlignment.Far,
                        LineAlignment = StringAlignment.Center
                    });
                }
                else if (X > Width - 52 & X < Width - 44 & Y < 18 & Y > 8)
                {
                    G.DrawString("r", controlFont, new SolidBrush(Color.FromArgb(178, 178, 178)), new Rectangle(-4, -6, Width, 35), new StringFormat
                    {
                        Alignment     = StringAlignment.Far,
                        LineAlignment = StringAlignment.Center
                    });
                    G.DrawString("1", controlFont, new SolidBrush(Color.FromArgb(178, 178, 178)), new Rectangle(-21, -5, Width, 35), new StringFormat
                    {
                        Alignment     = StringAlignment.Far,
                        LineAlignment = StringAlignment.Center
                    });
                    G.DrawString("0", controlFont, new SolidBrush(Color.FromArgb(255, 255, 255)), new Rectangle(-38, -6, Width, 35), new StringFormat
                    {
                        Alignment     = StringAlignment.Far,
                        LineAlignment = StringAlignment.Center
                    });
                }
                else
                {
                    G.DrawString("r", controlFont, new SolidBrush(Color.FromArgb(178, 178, 178)), new Rectangle(-4, -6, Width, 35), new StringFormat
                    {
                        Alignment     = StringAlignment.Far,
                        LineAlignment = StringAlignment.Center
                    });
                    G.DrawString("1", controlFont, new SolidBrush(Color.FromArgb(178, 178, 178)), new Rectangle(-21, -5, Width, 35), new StringFormat
                    {
                        Alignment     = StringAlignment.Far,
                        LineAlignment = StringAlignment.Center
                    });
                    G.DrawString("0", controlFont, new SolidBrush(Color.FromArgb(178, 178, 178)), new Rectangle(-38, -6, Width, 35), new StringFormat
                    {
                        Alignment     = StringAlignment.Far,
                        LineAlignment = StringAlignment.Center
                    });
                }
                break;

            case MouseState.Down:
                G.DrawString("r", controlFont, new SolidBrush(Color.FromArgb(178, 178, 178)), new Rectangle(-4, -6, Width, 35), new StringFormat
                {
                    Alignment     = StringAlignment.Far,
                    LineAlignment = StringAlignment.Center
                });
                G.DrawString("1", controlFont, new SolidBrush(Color.FromArgb(178, 178, 178)), new Rectangle(-21, -5, Width, 35), new StringFormat
                {
                    Alignment     = StringAlignment.Far,
                    LineAlignment = StringAlignment.Center
                });
                G.DrawString("0", controlFont, new SolidBrush(Color.FromArgb(178, 178, 178)), new Rectangle(-38, -6, Width, 35), new StringFormat
                {
                    Alignment     = StringAlignment.Far,
                    LineAlignment = StringAlignment.Center
                });
                break;
            }
        }