Example #1
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;
            Rectangle ClientRectangle = new Rectangle(0, 0, Width - 1, Height - 1);

            var _with2 = txtbox;

            _with2.Multiline = MultiLine;
            if (MultiLine == false)
            {
                Height = txtbox.Height + 11;
                if (WordWrap == true)
                {
                    _with2.WordWrap = true;
                }
                else
                {
                    _with2.WordWrap = false;
                }
            }
            else
            {
                txtbox.Height = Height - 11;
                if (WordWrap == true)
                {
                    _with2.WordWrap = true;
                }
                else
                {
                    _with2.WordWrap = false;
                }
            }
            _with2.Width                 = Width - 10;
            _with2.TextAlign             = TextAlignment;
            _with2.UseSystemPasswordChar = UseSystemPasswordChar;

            G.Clear(BackColor);

            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)
            };
            G.FillPath(new SolidBrush(Color.FromArgb(50, 50, 50)), Draw.RoundRect(ClientRectangle, 3));
            Draw.InnerGlowRounded(G, ClientRectangle, 3, c);

            e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0);
            G.Dispose();
            B.Dispose();
        }
        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);

            SolidBrush percentColor = new SolidBrush(Color.White);

            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)
            };
            G.FillPath(new SolidBrush(Color.FromArgb(50, 50, 50)), Draw.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 3));
            Draw.InnerGlowRounded(G, ClientRectangle, 3, c);

            ////// Bar Fill
            if (!(intValue == 0))
            {
                G.FillPath(new LinearGradientBrush(new Rectangle(1, 1, intValue, Height - 3), Color.FromArgb(30, 30, 30), Color.FromArgb(35, 35, 35), 90), Draw.RoundRect(new Rectangle(1, 1, intValue, Height - 3), 2));
                G.DrawPath(new Pen(Color.FromArgb(45, 45, 45)), Draw.RoundRect(new Rectangle(1, 1, intValue, Height - 3), 2));
                //G.DrawLine(New Pen(New SolidBrush(Color.FromArgb(15, 15, 15))), intValue + 1, 3, intValue + 1, Height - 4)
                percentColor = new SolidBrush(Color.White);
            }



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