/// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Control.Paint" /> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs" /> that contains the event data.</param>
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            base.OnPaint(e);
            Bar = new Rectangle(0, 10, Width - 1, Height - 21);

            Graphics G = e.Graphics;

            Bar = new Rectangle(10, 10, Width - 21, Height - 21);
            G.Clear(Parent.FindForm().BackColor);
            G.SmoothingMode = SmoothingMode.AntiAlias;

            //Background
            LinearGradientBrush BackLinear = new LinearGradientBrush(new Point(0, Convert.ToInt32((Height / 2) - 4)), new Point(0, Convert.ToInt32((Height / 2) + 4)), Color.FromArgb(50, Color.Black), Color.Transparent);

            G.FillPath(BackLinear, DesignFunctions.RoundRect(0, Convert.ToInt32((Height / 2) - 4), Width - 1, 8, 3));
            G.DrawPath(DesignFunctions.ToPen(50, Color.Black), DesignFunctions.RoundRect(0, Convert.ToInt32((Height / 2) - 4), Width - 1, 8, 3));
            BackLinear.Dispose();


            //Fill
            G.FillPath(new LinearGradientBrush(new Point(1, Convert.ToInt32((Height / 2) - 4)), new Point(1, Convert.ToInt32((Height / 2) + 4)), Color.FromArgb(250, 200, 70), Color.FromArgb(250, 160, 40)), DesignFunctions.RoundRect(1, Convert.ToInt32((Height / 2) - 4), Convert.ToInt32(Bar.Width * (Value / Maximum)) + Convert.ToInt32(Track.Width / 2), 8, 3));
            G.DrawPath(DesignFunctions.ToPen(100, Color.White), DesignFunctions.RoundRect(2, Convert.ToInt32((Height / 2) - 2), Convert.ToInt32(Bar.Width * (Value / Maximum)) + Convert.ToInt32(Track.Width / 2), 4, 3));
            G.SetClip(DesignFunctions.RoundRect(1, Convert.ToInt32((Height / 2) - 4), Convert.ToInt32(Bar.Width * (Value / Maximum)) + Convert.ToInt32(Track.Width / 2), 8, 3));
            for (int i = 0; i <= Convert.ToInt32(Bar.Width * (Value / Maximum)) + Convert.ToInt32(Track.Width / 2); i += 10)
            {
                G.DrawLine(new Pen(new SolidBrush(Color.FromArgb(20, Color.Black)), 4), new Point(i, Convert.ToInt32((Height / 2) - 10)), new Point(i - 10, Convert.ToInt32((Height / 2) + 10)));
            }
            G.SetClip(new Rectangle(0, 0, Width, Height));

            //Button
            G.FillEllipse(Brushes.White, Bar.X + Convert.ToInt32(Bar.Width * (Value / Maximum)) - Convert.ToInt32(Track.Width / 2), Bar.Y + Convert.ToInt32((Bar.Height / 2)) - Convert.ToInt32(Track.Height / 2), Track.Width, Track.Height);
            G.DrawEllipse(DesignFunctions.ToPen(50, Color.Black), Bar.X + Convert.ToInt32(Bar.Width * (Value / Maximum)) - Convert.ToInt32(Track.Width / 2), Bar.Y + Convert.ToInt32((Bar.Height / 2)) - Convert.ToInt32(Track.Height / 2), Track.Width, Track.Height);
            G.FillEllipse(new LinearGradientBrush(new Point(0, Bar.Y + Convert.ToInt32((Bar.Height / 2)) - Convert.ToInt32(Track.Height / 2)), new Point(0, Bar.Y + Convert.ToInt32((Bar.Height / 2)) - Convert.ToInt32(Track.Height / 2) + Track.Height), Color.FromArgb(200, Color.Black), Color.FromArgb(100, Color.Black)), new Rectangle(Bar.X + Convert.ToInt32(Bar.Width * (Value / Maximum)) - Convert.ToInt32(Track.Width / 2) + 6, Bar.Y + Convert.ToInt32((Bar.Height / 2)) - Convert.ToInt32(Track.Height / 2) + 6, Track.Width - 12, Track.Height - 12));
        }
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Control.Paint" /> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs" /> that contains the event data.</param>
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            base.OnPaint(e);
            Graphics G = e.Graphics;

            G.Clear(Parent.FindForm().BackColor);
            G.SmoothingMode = SmoothingMode.AntiAlias;

            //Background
            LinearGradientBrush BackLinear = new LinearGradientBrush(new Point(0, Convert.ToInt32((Height / 2) - 4)), new Point(0, Convert.ToInt32((Height / 2) + 4)), Color.FromArgb(50, Color.Black), Color.Transparent);

            G.FillPath(BackLinear, DesignFunctions.RoundRect(0, Convert.ToInt32((Height / 2) - 4), Width - 1, 8, 3));
            G.DrawPath(DesignFunctions.ToPen(50, Color.Black), DesignFunctions.RoundRect(0, Convert.ToInt32((Height / 2) - 4), Width - 1, 8, 3));
            BackLinear.Dispose();

            //Fill
            if (_value > 0)
            {
                G.FillPath(new LinearGradientBrush(new Point(1, Convert.ToInt32((Height / 2) - 4)), new Point(1, Convert.ToInt32((Height / 2) + 4)), Color.FromArgb(250, 200, 70), Color.FromArgb(250, 160, 40)), DesignFunctions.RoundRect(1, Convert.ToInt32((Height / 2) - 4), Convert.ToInt32((Width - 2) * (Value / Maximum)), 8, 3));
                G.DrawPath(DesignFunctions.ToPen(100, Color.White), DesignFunctions.RoundRect(2, Convert.ToInt32((Height / 2) - 2), Convert.ToInt32((Width - 4) * (Value / Maximum)), 4, 3));
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Control.Paint" /> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs" /> that contains the event data.</param>
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            base.OnPaint(e);
            Graphics G = e.Graphics;

            G.SmoothingMode = SmoothingMode.HighQuality;

            //Background
            G.FillPath(new LinearGradientBrush(new Point(0, 0), new Point(0, Height), Color.FromArgb(250, 200, 70), Color.FromArgb(250, 160, 40)), DesignFunctions.RoundRect(0, 0, Width - 1, Height - 1, 4));

            G.DrawPath(DesignFunctions.ToPen(50, Color.White), DesignFunctions.RoundRect(0, 1, Width - 1, Height - 2, 4));
            G.DrawPath(DesignFunctions.ToPen(150, 100, 70), DesignFunctions.RoundRect(0, 0, Width - 1, Height - 1, 4));
            switch (Enabled)
            {
            case true:
                switch (State)
                {
                case MouseState.Over:
                    G.FillPath(new LinearGradientBrush(new Point(0, 0), new Point(0, Height), Color.FromArgb(50, Color.White), Color.Transparent), DesignFunctions.RoundRect(0, 0, Width - 1, Height - 1, 4));
                    break;

                case MouseState.Down:
                    G.FillPath(new LinearGradientBrush(new Point(0, 0), new Point(0, Height), Color.FromArgb(50, Color.Black), Color.Transparent), DesignFunctions.RoundRect(0, 0, Width - 1, Height - 1, 4));
                    break;
                }

                G.DrawString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular), DesignFunctions.ToBrush(100, Color.White), new Point(Convert.ToInt32((Width / 2) - (G.MeasureString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular)).Width / 2)), Convert.ToInt32((Height / 2) - (G.MeasureString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular)).Height / 2)) + 1));
                G.DrawString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular), DesignFunctions.ToBrush(200, Color.Black), new Point(Convert.ToInt32((Width / 2) - (G.MeasureString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular)).Width / 2)), Convert.ToInt32((Height / 2) - (G.MeasureString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular)).Height / 2))));
                break;

            case false:
                G.DrawString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular), Brushes.White, new Point(Convert.ToInt32((Width / 2) - (G.MeasureString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular)).Width / 2)) + 1, Convert.ToInt32((Height / 2) - (G.MeasureString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular)).Height / 2)) + 1));
                G.DrawString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular), Brushes.Gray, new Point(Convert.ToInt32((Width / 2) - (G.MeasureString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular)).Width / 2)), Convert.ToInt32((Height / 2) - (G.MeasureString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular)).Height / 2))));
                break;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Control.Paint" /> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs" /> that contains the event data.</param>
        protected override void OnPaint(PaintEventArgs e)
        {
            Graphics   G          = e.Graphics;
            Rectangle  ItemBounds = default(Rectangle);
            SolidBrush TextBrush  = new SolidBrush(Color.Empty);
            int        SOFF       = 0;

            G.Clear(Color.FromArgb(236, 237, 239));

            for (int TabItemIndex = 0; TabItemIndex <= this.TabCount - 1; TabItemIndex++)
            {
                ItemBounds = this.GetTabRect(TabItemIndex);

                if (!(TabItemIndex == SelectedIndex))
                {
                    SOFF = 2;

                    G.FillPath(DesignFunctions.ToBrush(10, Color.Black), DesignFunctions.RoundRect(new Rectangle(new Point(ItemBounds.X, ItemBounds.Y + SOFF), new Size(ItemBounds.Width, ItemBounds.Height)), 2));
                    G.DrawPath(DesignFunctions.ToPen(90, Color.Black), DesignFunctions.RoundRect(new Rectangle(new Point(ItemBounds.X, ItemBounds.Y + SOFF), new Size(ItemBounds.Width, ItemBounds.Height)), 2));

                    StringFormat sf = new StringFormat();
                    sf.LineAlignment = StringAlignment.Center;
                    sf.Alignment     = StringAlignment.Center;
                    TextBrush.Color  = Color.FromArgb(80, 80, 80);
                    try
                    {
                        G.DrawString(TabPages[TabItemIndex].Text, new Font(Font.Name, Font.Size - 1), TextBrush, new Rectangle(GetTabRect(TabItemIndex).Location, GetTabRect(TabItemIndex).Size), sf);
                        TabPages[TabItemIndex].BackColor = Color.FromArgb(236, 237, 239);
                    }
                    catch
                    {
                    }
                }
            }

            G.FillPath(DesignFunctions.ToBrush(236, 237, 239), DesignFunctions.RoundRect(0, ItemSize.Height - 1, Width - 1, Height - ItemSize.Height - 1, 2));
            G.DrawPath(DesignFunctions.ToPen(150, 151, 153), DesignFunctions.RoundRect(0, ItemSize.Height - 1, Width - 1, Height - ItemSize.Height - 1, 2));

            for (int TabItemIndex = 0; TabItemIndex <= this.TabCount - 1; TabItemIndex++)
            {
                ItemBounds = this.GetTabRect(TabItemIndex);


                if (TabItemIndex == SelectedIndex)
                {
                    G.FillPath(DesignFunctions.ToBrush(236, 237, 239), DesignFunctions.RoundRect(new Rectangle(new Point(ItemBounds.X - 2, ItemBounds.Y), new Size(ItemBounds.Width + 3, ItemBounds.Height - 2)), 2));
                    G.DrawPath(DesignFunctions.ToPen(150, 151, 153), DesignFunctions.RoundRect(new Rectangle(new Point(ItemBounds.X - 2, ItemBounds.Y), new Size(ItemBounds.Width + 2, ItemBounds.Height - 2)), 2));

                    G.FillRectangle(DesignFunctions.ToBrush(236, 237, 239), new Rectangle(new Point(ItemBounds.X - 1, ItemBounds.Y + 1), new Size(ItemBounds.Width + 1, ItemBounds.Height)));
                    SOFF = 0;

                    StringFormat sf = new StringFormat();
                    sf.LineAlignment = StringAlignment.Center;
                    sf.Alignment     = StringAlignment.Center;
                    TextBrush.Color  = Color.FromArgb(80, 80, 80);
                    try
                    {
                        G.DrawString(TabPages[TabItemIndex].Text, Font, TextBrush, new Rectangle(new Point(Convert.ToInt32(GetTabRect(TabItemIndex).Location), SOFF), GetTabRect(TabItemIndex).Size), sf);
                        TabPages[TabItemIndex].BackColor = Color.FromArgb(236, 237, 239);
                    }
                    catch
                    {
                    }
                }
            }
        }