protected override void OnPaint(PaintEventArgs e)
        {
            Graphics _graphics = e.Graphics;

            _graphics.SmoothingMode     = SmoothingMode.HighQuality;
            _graphics.TextRenderingHint = _textRendererHint;

            Rectangle _clientRectangle = new Rectangle(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - 1, ClientRectangle.Height - 1);

            _controlGraphicsPath = VisualBorderRenderer.CreateBorderTypePath(_clientRectangle, _border);

            _graphics.FillRectangle(new SolidBrush(BackColor), new Rectangle(ClientRectangle.X - 1, ClientRectangle.Y - 1, ClientRectangle.Width + 1, ClientRectangle.Height + 1));
            _graphics.SetClip(_controlGraphicsPath);

            Color _backColor = Enabled ? _backColorState.Enabled : _backColorState.Disabled;

            VisualBackgroundRenderer.DrawBackground(_graphics, _backColor, BackgroundImage, _mouseState, _clientRectangle, Border);

            Rectangle _buttonRectangle  = new Rectangle(new Point(Width - _buttonWidth, 0), new Size(_buttonWidth, Height));
            Rectangle _textBoxRectangle = new Rectangle(0, 0, Width - _buttonWidth, Height);

            ConfigureSeparator(_buttonRectangle);

            DrawContent(_graphics, _textBoxRectangle);
            DrawButton(_graphics, _buttonRectangle);

            _graphics.ResetClip();

            DrawWatermark(_graphics, _textBoxRectangle);
            VisualBorderRenderer.DrawBorderStyle(_graphics, _border, _controlGraphicsPath, _mouseState);
        }
Beispiel #2
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            Graphics _graphics = e.Graphics;

            _graphics.Clear(Parent.BackColor);
            _graphics.SmoothingMode     = SmoothingMode.HighQuality;
            _graphics.TextRenderingHint = TextRenderingHint;
            Rectangle _clientRectangle = new Rectangle(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - 1, ClientRectangle.Height - 1);

            ControlGraphicsPath = VisualBorderRenderer.CreateBorderTypePath(_clientRectangle, _border);
            _graphics.FillRectangle(new SolidBrush(BackColor), new Rectangle(ClientRectangle.X - 1, ClientRectangle.Y - 1, ClientRectangle.Width + 1, ClientRectangle.Height + 1));

            Color _backColor = GDI.GetBackColorState(Enabled, BackColorState.Enabled, BackColorState.Hover, BackColorState.Pressed, BackColorState.Disabled, MouseState);

            e.Graphics.SetClip(ControlGraphicsPath);
            VisualBackgroundRenderer.DrawBackground(e.Graphics, _backColor, BackgroundImage, MouseState, _clientRectangle, _border);

            Color _textColor = Enabled ? ForeColor : ForeColorDisabled;

            VisualControlRenderer.DrawInternalContent(e.Graphics, ClientRectangle, Text, Font, _textColor, Image, _textImageRelation);
            VisualBorderRenderer.DrawBorderStyle(e.Graphics, _border, ControlGraphicsPath, MouseState);
            DrawAnimation(e.Graphics);
            e.Graphics.ResetClip();
        }
Beispiel #3
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            try
            {
                UpdateContextMenuStripTitle();

                Graphics graphics = e.Graphics;

                GraphicsPath _clientPath = VisualBorderRenderer.CreateBorderTypePath(GetBorderBounds(), _border);

                if (_border.Type != ShapeTypes.Rectangle)
                {
                    graphics.SetClip(_clientPath);
                }

                if (BackgroundImage != null)
                {
                    graphics.DrawImage(BackgroundImage, BodyContainer);
                }

                if (_windowTitleBarVisible)
                {
                    DrawWindowTitleBar(graphics);
                }

                graphics.ResetClip();
                VisualBorderRenderer.DrawBorderStyle(graphics, _border, _clientPath, State);
            }
            catch (Exception exception)
            {
                Logger.WriteDebug(exception);
            }
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            Graphics _graphics = e.Graphics;

            _graphics.SmoothingMode     = SmoothingMode.HighQuality;
            _graphics.TextRenderingHint = TextStyle.TextRenderingHint;
            Rectangle _clientRectangle = new Rectangle(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - 1, ClientRectangle.Height - 1);

            ControlGraphicsPath = VisualBorderRenderer.CreateBorderTypePath(_clientRectangle, _border);
            Color _backColor = Enabled ? _controlColorState.Enabled : _controlColorState.Disabled;

            _graphics.SetClip(ControlGraphicsPath);

            VisualBackgroundRenderer.DrawBackground(e.Graphics, _backColor, BackgroundImage, MouseState, _clientRectangle, Border);

            // Determines button/toggle state
            Point _startPoint     = new Point(0 + 2, (_clientRectangle.Height / 2) - (_buttonSize.Height / 2));
            Point _endPoint       = new Point(_clientRectangle.Width - _buttonSize.Width - 2, (_clientRectangle.Height / 2) - (_buttonSize.Height / 2));
            Point _buttonLocation = Toggle ? _endPoint : _startPoint;

            _buttonRectangle = new Rectangle(_buttonLocation, _buttonSize);
            DrawToggleText(_graphics);

            Color _buttonColor = ControlColorState.BackColorState(ButtonColorState, Enabled, MouseState);

            VisualBackgroundRenderer.DrawBackground(e.Graphics, _buttonColor, _buttonRectangle, _buttonBorder);

            VisualBorderRenderer.DrawBorderStyle(e.Graphics, _border, ControlGraphicsPath, MouseState);
            _graphics.ResetClip();
        }
        protected override void OnResize(EventArgs e)
        {
            base.OnResize(e);

            if (!_textBox.Multiline)
            {
                if (_borderImage.Visible)
                {
                    _textBox.Location = new Point(VisualBorderRenderer.CalculateBorderCurve(_border) + _imageWidth, _textBox.Location.Y);
                }
                else
                {
                    _textBox.Location = new Point(VisualBorderRenderer.CalculateBorderCurve(_border), _textBox.Location.Y);
                }

                if ((!_borderImage.Visible & !_borderButton.Visible) && AutoSize)
                {
                    _textBox.Width = GetInternalControlSize(Size, _border).Width;
                }

                _textBox.Height = GetTextBoxHeight();
                Size            = new Size(Width, VisualBorderRenderer.CalculateBorderCurve(_border) + _textBox.Height + VisualBorderRenderer.CalculateBorderCurve(_border));
            }
            else
            {
                _textBox.Location = GetInternalControlLocation(_border);
                _textBox.Size     = GetInternalControlSize(Size, _border);
            }

            Invalidate();
        }
Beispiel #6
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            try
            {
                Graphics graphics = e.Graphics;
                graphics.Clear(BackColor);

                GraphicsPath _clientPath = VisualBorderRenderer.CreateBorderTypePath(GetBorderBounds(), _border);

                if (_border.Type != ShapeType.Rectangle)
                {
                    graphics.SetClip(_clientPath);
                }

                graphics.FillRectangle(new SolidBrush(_background), new Rectangle(0, 0, Width, Height));

                if (BackgroundImage != null)
                {
                    Rectangle _windowWithoutTitleBar = new Rectangle(1, _textRectangle.Bottom, ClientRectangle.Width + 1, ClientRectangle.Height + 1);
                    graphics.DrawImage(BackgroundImage, _windowWithoutTitleBar);
                }

                DrawWindowTitleBar(graphics);
                graphics.ResetClip();
                VisualBorderRenderer.DrawBorderStyle(graphics, _border, _clientPath, State);
            }
            catch (Exception exception)
            {
                VisualExceptionDialog.Show(exception);
            }
        }
Beispiel #7
0
        protected override void OnPaint(PaintEventArgs e)
        {
            Graphics _graphics = e.Graphics;

            _graphics.Clear(Parent.BackColor);
            _graphics.SmoothingMode     = SmoothingMode.HighQuality;
            _graphics.TextRenderingHint = _textRendererHint;
            _graphics.FillRectangle(new SolidBrush(BackColor), ClientRectangle);

            Rectangle _clientRectangle = new Rectangle(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - 1, ClientRectangle.Height - 1);

            _controlGraphicsPath = VisualBorderRenderer.CreateBorderTypePath(_clientRectangle, _border);

            Color _textColor = Enabled ? _foreColor : _textDisabledColor;
            Color _backColor = Enabled ? _backColorState.Enabled : _backColorState.Disabled;

            _graphics.FillRectangle(new SolidBrush(BackColor), ClientRectangle);
            _graphics.SetClip(_controlGraphicsPath);
            VisualBackgroundRenderer.DrawBackground(_graphics, _backColor, BackgroundImage, _mouseState, _clientRectangle, Border);

            Point _textBoxLocation;
            Point _buttonLocation;
            Size  _buttonSize = new Size(_buttonWidth, Height);

            if (_buttonHorizontal == Alignment.Horizontal.Right)
            {
                _buttonLocation  = new Point(Width - _buttonWidth, 0);
                _textBoxLocation = new Point(0, 0);
            }
            else
            {
                _buttonLocation  = new Point(0, 0);
                _textBoxLocation = new Point(_buttonWidth, 0);
            }

            Rectangle _buttonRectangle  = new Rectangle(_buttonLocation, _buttonSize);
            Rectangle _textBoxRectangle = new Rectangle(_textBoxLocation.X, _textBoxLocation.Y, Width - _buttonWidth, Height);

            DrawButton(_graphics, _buttonRectangle);

            DrawSeparator(_buttonRectangle);

            StringFormat _stringFormat = new StringFormat
            {
                Alignment     = _textAlignment,
                LineAlignment = StringAlignment.Center
            };

            ConfigureDirection(_textBoxRectangle, _buttonRectangle);
            _graphics.DrawString(Text, Font, new SolidBrush(_textColor), _textBoxRectangle, _stringFormat);

            if (Text.Length == 0)
            {
                Watermark.DrawWatermark(_graphics, _textBoxRectangle, _stringFormat, _watermark);
            }

            VisualBorderRenderer.DrawBorderStyle(_graphics, _border, _controlGraphicsPath, _mouseState);
            _graphics.ResetClip();
        }
Beispiel #8
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            try
            {
                Graphics graphics = e.Graphics;
                graphics.Clear(BackColor);
                graphics.SmoothingMode     = SmoothingMode.Default;
                graphics.TextRenderingHint = TextRenderingHint.AntiAlias;

                Rectangle _clientRectangle;

                switch (_border.Type)
                {
                case ShapeType.Rectangle:
                {
                    _clientRectangle = new Rectangle(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width + 1, ClientRectangle.Height + 1);
                    break;
                }

                case ShapeType.Rounded:
                {
                    _clientRectangle = new Rectangle(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - 1, ClientRectangle.Height - 1);
                    break;
                }

                default:
                {
                    throw new ArgumentOutOfRangeException();
                }
                }

                GraphicsPath _clientPath = VisualBorderRenderer.CreateBorderTypePath(_clientRectangle, _border);

                graphics.SetClip(_clientPath);
                graphics.FillPath(new SolidBrush(_background), _clientPath);

                _statusBarBounds = new Rectangle(0, 0, Width, _windowBarHeight);
                graphics.FillRectangle(new SolidBrush(_windowBarColor), _statusBarBounds);

                DrawImageIcon(graphics);

                graphics.SetClip(_clientPath);

                DrawTitle(graphics);

                graphics.ResetClip();

                VisualBorderRenderer.DrawBorderStyle(graphics, _border, _clientPath, State);
            }
            catch (Exception exception)
            {
                VisualExceptionDialog.Show(exception);
            }
        }
Beispiel #9
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            Graphics  graphics         = e.Graphics;
            Rectangle _clientRectangle = new Rectangle(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - 1, ClientRectangle.Height - 1);

            ControlGraphicsPath = VisualBorderRenderer.CreateBorderTypePath(_clientRectangle, _border);

            Color _backColor = Enabled ? _backColorState.Enabled : _backColorState.Disabled;

            if (_textBox.BackColor != _backColor)
            {
                _textBox.BackColor = _backColor;
            }

            graphics.SetClip(ControlGraphicsPath);

            VisualBackgroundRenderer.DrawBackground(graphics, _backColor, BackgroundImage, MouseState, _clientRectangle, _border);

            _buttonRectangle = new Rectangle(_textBox.Right, _border.Thickness, Width - _textBox.Right - _border.Thickness, Height);
            _imageRectangle  = new Rectangle(0, 0, _imageWidth, Height);

            if (!_textBox.Multiline)
            {
                if (_borderImage.Visible)
                {
                    _textBox.Location = new Point(_border.BorderCurve + _imageRectangle.Width, _textBox.Location.Y);

                    DrawImage(graphics);

                    if (_borderButton.Visible)
                    {
                        DrawButton(graphics);
                    }
                }
                else
                {
                    _textBox.Location = new Point(_border.BorderCurve, _textBox.Location.Y);

                    if (_borderButton.Visible)
                    {
                        DrawButton(graphics);
                    }
                }
            }

            graphics.ResetClip();

            if (_watermark.Visible)
            {
                DrawWaterMark();
            }

            VisualBorderRenderer.DrawBorderStyle(e.Graphics, _border, ControlGraphicsPath, MouseState);
        }
Beispiel #10
0
        private void DrawKnob()
        {
            Point     knobPoint     = new Point((_knobRectangle.X + (_knobRectangle.Width / 2)) - (KnobSize.Width / 2), (_knobRectangle.Y + (_knobRectangle.Height / 2)) - (KnobSize.Height / 2));
            Rectangle knobRectangle = new Rectangle(knobPoint, KnobSize);

            _offGraphics.FillEllipse(_knob.Brush, knobRectangle);

            GraphicsPath borderPath = new GraphicsPath();

            borderPath.AddEllipse(knobRectangle);
            VisualBorderRenderer.DrawBorderStyle(_offGraphics, _knobBorder, borderPath, State);
        }
Beispiel #11
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            Graphics graphics = e.Graphics;

            graphics.SmoothingMode = SmoothingMode.HighQuality;

            Rectangle _clientRectangle = new Rectangle(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - 1, ClientRectangle.Height - 1);

            ControlGraphicsPath = VisualBorderRenderer.CreateBorderTypePath(_clientRectangle, _border);

            Color _backColor = Enabled ? BackColorState.Enabled : BackColorState.Disabled;

            VisualBackgroundRenderer.DrawBackground(e.Graphics, _backColor, BackgroundImage, MouseState, _clientRectangle, Border);
            VisualBorderRenderer.DrawBorderStyle(e.Graphics, _border, ControlGraphicsPath, MouseState);
        }
        private void DrawColorPicker(PaintEventArgs e, HSLManager _manager, bool includeFocus)
        {
            var x = 0;
            var y = 0;

            switch (_pickType)
            {
            case PickerType.Rectangle:
            {
                x = _mousePosition.X;
                y = _mousePosition.Y;

                break;
            }

            case PickerType.Wheel:
            {
                PointF location = GetColorLocation(_manager);

                if (!float.IsNaN(location.X) && !float.IsNaN(location.Y))
                {
                    x = (int)location.X - (SelectionSize / 2);
                    y = (int)location.Y - (SelectionSize / 2);
                }

                break;
            }

            default:
                throw new ArgumentOutOfRangeException();
            }

            // Create the button path
            GraphicsPath _buttonGraphicsPath = VisualBorderRenderer.CreateBorderTypePath(new Rectangle(x - (SelectionSize / 2), y - (SelectionSize / 2), SelectionSize, SelectionSize), 10, 1, ShapeTypes.Rounded);

            // Draw button
            e.Graphics.FillPath(new SolidBrush(_buttonColor), _buttonGraphicsPath);

            // Draw border
            VisualBorderRenderer.DrawBorderStyle(e.Graphics, _pickerBorder, _buttonGraphicsPath, MouseState);

            if (Focused && includeFocus)
            {
                ControlPaint.DrawFocusRectangle(e.Graphics, new Rectangle(x - 1, y - 1, SelectionSize + 2, SelectionSize + 2));
            }
        }
Beispiel #13
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            try
            {
                Graphics _graphics = e.Graphics;
                _graphics.Clear(Parent.BackColor);
                _graphics.SmoothingMode     = SmoothingMode.HighQuality;
                _graphics.TextRenderingHint = TextStyle.TextRenderingHint;
                Rectangle _clientRectangle = new Rectangle(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - 1, ClientRectangle.Height - 1);
                ControlGraphicsPath = VisualBorderRenderer.CreateBorderTypePath(_clientRectangle, _border);
                _graphics.FillRectangle(new SolidBrush(BackColor), new Rectangle(ClientRectangle.X - 1, ClientRectangle.Y - 1, ClientRectangle.Width + 1, ClientRectangle.Height + 1));

                Color _backColor = ControlColorState.BackColorState(BackColorState, Enabled, MouseState);

                e.Graphics.SetClip(ControlGraphicsPath);
                VisualBackgroundRenderer.DrawBackground(e.Graphics, _backColor, BackgroundImage, MouseState, _clientRectangle, _border);

                Color _textColor = Enabled ? ForeColor : TextStyle.Disabled;

                if (_image != null)
                {
                    VisualControlRenderer.DrawContent(e.Graphics, ClientRectangle, Text, Font, _textColor, _image, _image.Size, _textImageRelation);
                }
                else
                {
                    StringFormat _stringFormat = new StringFormat
                    {
                        Alignment     = _textAlignment,
                        LineAlignment = _textLineAlignment
                    };

                    VisualControlRenderer.DrawContentText(e.Graphics, ClientRectangle, Text, Font, _textColor, _stringFormat);
                }

                VisualBorderRenderer.DrawBorderStyle(e.Graphics, _border, ControlGraphicsPath, MouseState);
                DrawAnimation(e.Graphics);
                e.Graphics.ResetClip();
            }
            catch (Exception exception)
            {
                VisualExceptionDialog.Show(exception);
            }
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            Rectangle _clientRectangle = new Rectangle(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - 1, ClientRectangle.Height - 1);

            ControlGraphicsPath = VisualBorderRenderer.CreateBorderTypePath(_clientRectangle, _border);
            Color _backColor = Enabled ? _backColorState.Enabled : _backColorState.Disabled;

            if (_richTextBox.BackColor != _backColor)
            {
                _richTextBox.BackColor = _backColor;
            }

            e.Graphics.SetClip(ControlGraphicsPath);
            VisualBackgroundRenderer.DrawBackground(e.Graphics, _backColor, BackgroundImage, MouseState, _clientRectangle, Border);
            VisualBorderRenderer.DrawBorderStyle(e.Graphics, _border, ControlGraphicsPath, MouseState);
            e.Graphics.ResetClip();
        }
Beispiel #15
0
        /// <summary>Draws the bitmap image.</summary>
        /// <param name="graphics">Graphics controller.</param>
        /// <param name="_border">The border.</param>
        /// <param name="_imagePoint">The location.</param>
        /// <param name="_image">The image.</param>
        /// <param name="_imageSize">The size.</param>
        /// <param name="_visible">The visibility.</param>
        public static void DrawImage(Graphics graphics, Border _border, Point _imagePoint, Bitmap _image, Size _imageSize, bool _visible)
        {
            if (_image != null)
            {
                using (GraphicsPath imagePath = new GraphicsPath())
                {
                    imagePath.AddRectangle(new Rectangle(_imagePoint, _imageSize));

                    if (_border.Visible)
                    {
                        VisualBorderRenderer.DrawBorder(graphics, imagePath, _border.Color, thickness: _border.Thickness);
                    }
                }

                if (_visible)
                {
                    graphics.DrawImage(_image, new Rectangle(_imagePoint, _imageSize));
                }
            }
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            if (AutoSize)
            {
                _box = new Rectangle(new Point(Padding.Left, (ClientRectangle.Height / 2) - (_box.Height / 2)), _box.Size);
                AutoFit(Text.MeasureText(Font));
            }
            else
            {
                _box = new Rectangle(new Point(Padding.Left, (ClientRectangle.Height / 2) - (_box.Height / 2)), _box.Size);
            }

            Color _backColor = ControlColorState.BackColorState(BoxColorState, Enabled, MouseState);

            Graphics _graphics = e.Graphics;

            _graphics.Clear(Parent.BackColor);
            _graphics.SmoothingMode     = SmoothingMode.HighQuality;
            _graphics.TextRenderingHint = TextStyle.TextRenderingHint;

            Rectangle _clientRectangle = new Rectangle(ClientRectangle.X - 1, ClientRectangle.Y - 1, ClientRectangle.Width + 2, ClientRectangle.Height + 2);
            Shape     _clientShape     = new Shape(ShapeTypes.Rectangle, _backColor, 0);

            GraphicsPath _clientPath = VisualBorderRenderer.CreateBorderTypePath(_clientRectangle, _clientShape);

            ControlGraphicsPath = VisualBorderRenderer.CreateBorderTypePath(_clientRectangle, _border);

            e.Graphics.SetClip(_clientPath);

            _graphics.FillRectangle(new SolidBrush(BackColor), _clientRectangle);

            _textSize = TextManager.MeasureText(Text, Font, _graphics);
            Point _textLocation = new Point(_box.Right + _boxSpacing, (ClientRectangle.Height / 2) - (_textSize.Height / 2));
            Color _textColor    = Enabled ? ForeColor : TextStyle.Disabled;

            VisualToggleRenderer.DrawCheckBox(_graphics, Border, _checkStyle, _box, Checked, Enabled, _backColor, BackgroundImage, MouseState, Text, Font, _textColor, _textLocation);
            DrawAnimation(_graphics);
            e.Graphics.ResetClip();
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            Graphics _graphics = e.Graphics;

            _graphics.SmoothingMode     = SmoothingMode.HighQuality;
            _graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
            _graphics.TextRenderingHint = TextStyle.TextRenderingHint;
            Rectangle _clientRectangle = new Rectangle(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - 1, ClientRectangle.Height - 1);

            ControlGraphicsPath = VisualBorderRenderer.CreateBorderTypePath(_clientRectangle, _border);

            _graphics.SetClip(ControlGraphicsPath);

            Color _backColor = Enabled ? BackColorState.Enabled : BackColorState.Disabled;

            VisualBackgroundRenderer.DrawBackground(_graphics, _backColor, BackgroundImage, MouseState, _clientRectangle, _border);

            DrawProgress(_orientation, _graphics);
            VisualBorderRenderer.DrawBorderStyle(e.Graphics, _border, ControlGraphicsPath, MouseState);
            e.Graphics.ResetClip();
        }
        public void DrawAnimation(Graphics graphics)
        {
            if (_animation && _rippleEffectsManager.IsAnimating())
            {
                for (var i = 0; i < _rippleEffectsManager.GetAnimationCount(); i++)
                {
                    double animationValue = _rippleEffectsManager.GetProgress(i);

                    Point      animationSource = new Point(_box.X + (_box.Width / 2), _box.Y + (_box.Height / 2));
                    SolidBrush animationBrush  = new SolidBrush(Color.FromArgb((int)(animationValue * 40), (bool)_rippleEffectsManager.GetData(i)[0] ? Color.Black : _checkStyle.CheckColor));

                    int height = _box.Height;
                    int size   = _rippleEffectsManager.GetDirection(i) == AnimationDirection.InOutIn ? (int)(height * (0.8d + (0.2d * animationValue))) : height;

                    Rectangle    _animationBox = new Rectangle(animationSource.X - (size / 2), animationSource.Y - (size / 2), size, size);
                    GraphicsPath _path         = VisualBorderRenderer.CreateBorderTypePath(_animationBox, _border);

                    graphics.FillPath(animationBrush, _path);
                    animationBrush.Dispose();
                }
            }
        }
Beispiel #19
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            try
            {
                Graphics _graphics = e.Graphics;

                _graphics.SmoothingMode     = SmoothingMode.HighQuality;
                _graphics.TextRenderingHint = TextStyle.TextRenderingHint;
                Rectangle _clientRectangle = new Rectangle(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - 1, ClientRectangle.Height - 1);
                ControlGraphicsPath = VisualBorderRenderer.CreateBorderTypePath(_clientRectangle, _border);

                Color _backColor = ControlColorState.BackColorState(BackColorState, Enabled, MouseState);

                e.Graphics.SetClip(ControlGraphicsPath);
                VisualBackgroundRenderer.DrawBackground(e.Graphics, _backColor, BackgroundImage, MouseState, _clientRectangle, _border);

                if (_image != null)
                {
                    Color _textColor = Enabled ? ForeColor : TextStyle.Disabled;
                    VisualControlRenderer.DrawContent(e.Graphics, ClientRectangle, Text, Font, _textColor, _image, _image.Size, _textImageRelation);
                }
                else
                {
                    VisualTextRenderer.RenderText(e.Graphics, ClientRectangle, Text, Font, Enabled, MouseState, TextStyle);
                }

                VisualBorderRenderer.DrawBorderStyle(e.Graphics, _border, ControlGraphicsPath, MouseState);
                DrawAnimation(e.Graphics);
                e.Graphics.ResetClip();
            }
            catch (Exception exception)
            {
                Logger.WriteDebug(exception);
            }
        }
Beispiel #20
0
        private void DrawProgress(Orientation orientation, Graphics graphics)
        {
            if (_progressBarStyle == ProgressBarStyle.Marquee)
            {
                if (!DesignMode && Enabled)
                {
                    StartTimer();
                }

                if (!Enabled)
                {
                    StopTimer();
                }

                if (Value == Maximum)
                {
                    StopTimer();
                    DrawProgressContinuous(graphics);
                }
                else
                {
                    DrawProgressMarquee(graphics);
                }
            }
            else
            {
                int _indexValue;

                GraphicsPath _progressPath;
                Rectangle    _progressRectangle;

                switch (orientation)
                {
                case Orientation.Horizontal:
                {
                    _indexValue        = (int)Math.Round(((Value - Minimum) / (double)(Maximum - Minimum)) * (Width - 2));
                    _progressRectangle = new Rectangle(0, 0, _indexValue + _border.Thickness, Height);
                    _progressPath      = VisualBorderRenderer.CreateBorderTypePath(_progressRectangle, _border);
                }

                break;

                case Orientation.Vertical:
                {
                    _indexValue        = (int)Math.Round(((Value - Minimum) / (double)(Maximum - Minimum)) * (Height - 2));
                    _progressRectangle = new Rectangle(0, Height - _indexValue - _border.Thickness - 1, Width, _indexValue);
                    _progressPath      = VisualBorderRenderer.CreateBorderTypePath(_progressRectangle, _border);
                }

                break;

                default:
                {
                    throw new ArgumentOutOfRangeException(nameof(orientation), orientation, null);
                }
                }

                if (_indexValue > 1)
                {
                    graphics.SetClip(ControlGraphicsPath);
                    graphics.FillRectangle(new SolidBrush(_progressColor), _progressRectangle);
                    VisualControlRenderer.DrawHatch(graphics, _hatch, _progressPath);
                    graphics.ResetClip();
                }
            }

            DrawText(graphics);
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            try
            {
                if (GetStyle(ControlStyles.AllPaintingInWmPaint))
                {
                    OnPaintBackground(e);
                }

                MinimumSize = new Size(0, GetPreferredSize(Size.Empty).Height);

                Rectangle    _clientRectangle    = new Rectangle(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - 1, ClientRectangle.Height - 1);
                GraphicsPath controlGraphicsPath = VisualBorderRenderer.CreateBorderTypePath(_clientRectangle, _border);
                Color        backColorState      = ColorState.BackColorState(_backColor, Enabled, MouseState);

                e.Graphics.SetClip(controlGraphicsPath);
                VisualBackgroundRenderer.DrawBackground(e.Graphics, backColorState, BackgroundImage, MouseState, _clientRectangle, _border);
                VisualBorderRenderer.DrawBorderStyle(e.Graphics, _border, controlGraphicsPath, _mouseState);
                Rectangle arrowRectangle = new Rectangle(Width - _arrowSize.Width - 5, (Height / 2) - (_arrowSize.Height / 2), _arrowSize.Width, _arrowSize.Height);

                if (_image != null)
                {
                    e.Graphics.DrawImage(_image, new Rectangle(arrowRectangle.Left - _image.Width - 2, (Height / 2) - (_image.Height / 2), _imageSize.Width, _imageSize.Height));
                }

                VisualElementRenderer.RenderTriangle(e.Graphics, _arrowColor, _arrowDisabledColor, Enabled, _dropDownImage, arrowRectangle, Alignment.Vertical.Down);

                var       _check            = 0;
                Rectangle checkBoxRectangle = new Rectangle(3, (Height / 2) - 6, 12, 12);

                if (ShowCheckBox)
                {
                    _check = 15;

                    if (Checked)
                    {
                        CheckBoxRenderer.DrawCheckBox(e.Graphics, checkBoxRectangle.Location, CheckBoxState.CheckedNormal);
                    }
                    else
                    {
                        CheckBoxRenderer.DrawCheckBox(e.Graphics, checkBoxRectangle.Location, CheckBoxState.UncheckedNormal);
                    }
                }

                Size textSize = TextManager.MeasureText(Text, Font);

                Rectangle textBoxRectangle = new Rectangle(2 + _check, (Height / 2) - (textSize.Height / 2), textSize.Width, textSize.Height);
                TextRenderer.DrawText(e.Graphics, Text, Font, textBoxRectangle, ForeColor, TextFormatFlags.Left | TextFormatFlags.VerticalCenter);

                if (_showFocus && _focused)
                {
                    ControlPaint.DrawFocusRectangle(e.Graphics, ClientRectangle);
                }

                e.Graphics.ResetClip();
            }
            catch
            {
                Invalidate();
            }
        }
Beispiel #22
0
 /// <summary>Converts the GraphicsPath to a border path.</summary>
 /// <param name="borderPath">The border path.</param>
 /// <param name="border">The border.</param>
 /// <returns>Converted border path.</returns>
 public static GraphicsPath ToBorderPath(this GraphicsPath borderPath, Border border)
 {
     return(VisualBorderRenderer.CreateBorderTypePath(borderPath.GetBounds().ToRectangle(), border));
 }
Beispiel #23
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            Graphics graphics = e.Graphics;

            // graphics.Clear(Parent.BackColor);
            graphics.SmoothingMode      = SmoothingMode.HighQuality;
            graphics.CompositingQuality = CompositingQuality.GammaCorrected;

            Size      textArea = GDI.MeasureText(graphics, Text, Font);
            Rectangle group    = ConfigureStyleBox(textArea);
            Rectangle title    = ConfigureStyleTitleBox(textArea);

            _titleBoxRectangle = new Rectangle(title.X, title.Y, title.Width - 1, title.Height);

            Rectangle _clientRectangle = new Rectangle(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - 1, ClientRectangle.Height - 1);

            ControlGraphicsPath = VisualBorderRenderer.CreateBorderTypePath(_clientRectangle, _border);
            graphics.FillRectangle(new SolidBrush(BackColor), _clientRectangle);

            Color _backColor = Enabled ? BackColorState.Enabled : BackColorState.Disabled;

            VisualBackgroundRenderer.DrawBackground(e.Graphics, _backColor, BackgroundImage, MouseState, group, Border);

            if (_borderEdge.Visible)
            {
                switch (TitleAlignment)
                {
                case TitleAlignments.Bottom:
                {
                    _borderEdge.Location = new Point(_titleBoxRectangle.X + _border.Thickness, _titleBoxRectangle.Y);
                    _borderEdge.Size     = new Size(Width - _border.Thickness - 1, 1);
                    break;
                }

                case TitleAlignments.Top:
                {
                    _borderEdge.Location = new Point(_titleBoxRectangle.X + _border.Thickness, _titleBoxRectangle.Bottom);
                    _borderEdge.Size     = new Size(Width - _border.Thickness - 1, 1);
                    break;
                }

                default:
                {
                    throw new ArgumentOutOfRangeException();
                }
                }
            }

            if (_boxStyle == GroupBoxStyle.Classic)
            {
                graphics.FillRectangle(new SolidBrush(BackColorState.Enabled), _titleBoxRectangle);
                graphics.DrawString(Text, Font, new SolidBrush(ForeColor), _titleBoxRectangle);
            }
            else
            {
                StringFormat stringFormat = new StringFormat
                {
                    Alignment     = _stringAlignment,
                    LineAlignment = StringAlignment.Center
                };

                graphics.DrawString(Text, Font, new SolidBrush(ForeColor), _titleBoxRectangle, stringFormat);
            }

            VisualBorderRenderer.DrawBorderStyle(e.Graphics, _border, ControlGraphicsPath, MouseState);
        }
Beispiel #24
0
        private void DrawKnobTop()
        {
            Point     knobTopPoint     = new Point((_knobRectangle.X + (_knobRectangle.Width / 2)) - (KnobTopSize.Width / 2), (_knobRectangle.Y + (_knobRectangle.Height / 2)) - (KnobTopSize.Height / 2));
            Rectangle knobTopRectangle = new Rectangle(knobTopPoint, KnobTopSize);

            _offGraphics.FillEllipse(_knobTop.Brush, knobTopRectangle);

            GraphicsPath borderPath = new GraphicsPath();

            borderPath.AddEllipse(knobTopRectangle);
            VisualBorderRenderer.DrawBorderStyle(_offGraphics, _knobTopBorder, borderPath, State);

            float cx = _knobPoint.X;
            float cy = _knobPoint.Y;

            float w = KnobTopSize.Width;

            // TODO: Adjust
            float incr         = MathManager.DegreeToRadians((_startAngle - _endAngle) / ((_buttonDivisions - 1) * (_scaleSubDivisions + 1)));
            float currentAngle = MathManager.DegreeToRadians(0);

            float radius = KnobTickSize.Width / 2;

            Pen penL = new Pen(TickColor, 2 * _drawRatio);

            PointF ptStart = new PointF(0, 0);
            PointF ptEnd   = new PointF(0, 0);
            var    n       = 0;

            for (; n < _buttonDivisions; n++)
            {
                // draw divisions
                ptStart.X = (float)(cx + (radius * Math.Cos(currentAngle)));
                ptStart.Y = (float)(cy + (radius * Math.Sin(currentAngle)));

                ptEnd.X = (float)(cx + ((radius + (w / 50)) * Math.Cos(currentAngle)));
                ptEnd.Y = (float)(cy + ((radius + (w / 50)) * Math.Sin(currentAngle)));

                // TODO: draw lines along button border
                // gOffScreen.DrawLine(penL, ptStart, ptEnd);

                // Draw graduations Strings
                float fSize = 6F * _drawRatio;
                if (fSize < 6)
                {
                    fSize = 6;
                }

                Font font = new Font(Font.FontFamily, fSize);

                if (n == _buttonDivisions - 1)
                {
                    font.Dispose();
                    break;
                }

                // Subdivisions
                if (_buttonDivisions <= 0)
                {
                    currentAngle += incr;
                }
                else
                {
                    for (var j = 0; j <= _scaleSubDivisions; j++)
                    {
                        currentAngle += incr;
                    }
                }

                font.Dispose();
            }
        }
Beispiel #25
0
        /// <summary>Initializes a new instance of the <see cref="VisualTextBox" /> class.</summary>
        public VisualTextBox()
        {
            SetStyle(ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor, true);

            // Contains another control
            SetStyle(ControlStyles.ContainerControl, true);

            // Cannot select this control, only the child and does not generate a click event
            SetStyle(ControlStyles.Selectable | ControlStyles.StandardClick, false);

            _borderButton = new BorderEdge {
                Visible = false
            };

            _borderImage = new BorderEdge {
                Visible = false
            };

            _textWidth = 125;
            _border    = new Border();

            ThemeManager    = new StyleManager(Settings.DefaultValue.DefaultStyle);
            _backColorState = new ColorState
            {
                Enabled = ThemeManager.Theme.BackgroundSettings.Type4
            };

            _textBox = new TextBox
            {
                Size        = new Size(_textWidth, 25),
                Location    = new Point(VisualBorderRenderer.CalculateBorderCurve(_border), VisualBorderRenderer.CalculateBorderCurve(_border)),
                Text        = string.Empty,
                BorderStyle = BorderStyle.None,
                TextAlign   = HorizontalAlignment.Left,
                Font        = Font,
                ForeColor   = ForeColor,
                BackColor   = _backColorState.Enabled,
                Multiline   = false
            };

            _imageWidth   = 35;
            _buttonFont   = Font;
            _buttonIndent = 3;
            _buttontext   = "visualButton";

            _image     = null;
            _imageSize = new Size(16, 16);

            _watermark    = new Watermark();
            _buttonBorder = new Border();

            Size = new Size(135, 25);

            _textBox.KeyDown     += TextBox_KeyDown;
            _textBox.Leave       += OnLeave;
            _textBox.Enter       += OnEnter;
            _textBox.GotFocus    += OnEnter;
            _textBox.LostFocus   += OnLeave;
            _textBox.MouseLeave  += OnLeave;
            _textBox.TextChanged += TextBox_TextChanged;
            _textBox.SizeChanged += TextBox_SizeChanged;

            Controls.Add(_textBox);
            Controls.Add(_borderButton);
            Controls.Add(_borderImage);

            _waterMarkContainer = null;

            if (_watermark.Visible)
            {
                DrawWaterMark();
            }

            UpdateTheme(ThemeManager.Theme);
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            Graphics _graphics = e.Graphics;

            _graphics.Clear(Parent.BackColor);
            _graphics.SmoothingMode     = SmoothingMode.HighQuality;
            _graphics.TextRenderingHint = TextStyle.TextRenderingHint;

            Rectangle _clientRectangle = new Rectangle(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - 1, ClientRectangle.Height - 1);

            ControlGraphicsPath = VisualBorderRenderer.CreateBorderTypePath(_clientRectangle, _border);

            _graphics.FillRectangle(new SolidBrush(BackColor), new Rectangle(ClientRectangle.X - 1, ClientRectangle.Y - 1, ClientRectangle.Width + 1, ClientRectangle.Height + 1));
            _graphics.SetClip(ControlGraphicsPath);

            _buttonRectangle = new Rectangle(Width - _buttonWidth, 1, _buttonWidth, Height);

            Size incrementSize = GraphicsManager.MeasureText("+", _buttonFont, _graphics);
            Size decrementSize = GraphicsManager.MeasureText("-", _buttonFont, _graphics);

            _incrementButtonPoints[0] = new Point((_buttonRectangle.X + (_buttonRectangle.Width / 2)) - (incrementSize.Width / 2), (_buttonRectangle.Y + (_buttonRectangle.Height / 2)) - (_buttonRectangle.Height / 4) - (incrementSize.Height / 2));
            _decrementButtonPoints[0] = new Point((_buttonRectangle.X + (_buttonRectangle.Width / 2)) - (decrementSize.Width / 2), (_buttonRectangle.Y + (_buttonRectangle.Height / 2) + (_buttonRectangle.Height / 4)) - (decrementSize.Height / 2));

            _incrementButtonPoints[1] = new Point((_buttonRectangle.X + (_buttonRectangle.Width / 4)) - (incrementSize.Width / 2), (Height / 2) - (incrementSize.Height / 2));
            _decrementButtonPoints[1] = new Point((_buttonRectangle.X + (_buttonRectangle.Width / 2) + (_buttonRectangle.Width / 4)) - (decrementSize.Width / 2), (Height / 2) - (decrementSize.Height / 2));

            int toggleInt;

            switch (_buttonOrientation)
            {
            case Orientation.Horizontal:
            {
                toggleInt = 1;
                _borderButtons.Location = new Point(_buttonRectangle.X + (_buttonRectangle.Width / 2), _border.Thickness);
                _borderButtons.Size     = new Size(1, Height - _border.Thickness - 1);
                break;
            }

            case Orientation.Vertical:
            {
                toggleInt = 0;
                _borderButtons.Location = new Point(_buttonRectangle.X, (_buttonRectangle.Bottom / 2) - _border.Thickness);
                _borderButtons.Size     = new Size(Width - _border.Thickness - 1, 1);
                break;
            }

            default:
            {
                throw new ArgumentOutOfRangeException();
            }
            }

            _buttonPath = new GraphicsPath();
            _buttonPath.AddRectangle(_buttonRectangle);
            _buttonPath.CloseAllFigures();

            Color _backColor = Enabled ? BackColorState.Enabled : BackColorState.Disabled;

            VisualBackgroundRenderer.DrawBackground(e.Graphics, _backColor, BackgroundImage, MouseState, _clientRectangle, Border);

            _graphics.SetClip(ControlGraphicsPath);
            _graphics.FillRectangle(new SolidBrush(_buttonColor), _buttonRectangle);
            _graphics.ResetClip();

            _graphics.DrawString("+", _buttonFont, new SolidBrush(_buttonForeColor), _incrementButtonPoints[toggleInt]);
            _graphics.DrawString("-", _buttonFont, new SolidBrush(_buttonForeColor), _decrementButtonPoints[toggleInt]);

            _borderEdge.Location = new Point(_buttonRectangle.X, _border.Thickness);
            _borderEdge.Size     = new Size(1, Height - _border.Thickness - 1);

            DrawText(_graphics);

            VisualBorderRenderer.DrawBorderStyle(e.Graphics, _border, ControlGraphicsPath, MouseState);
        }
Beispiel #27
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            try
            {
                Graphics graphics = e.Graphics;
                graphics.SmoothingMode      = SmoothingMode.HighQuality;
                graphics.CompositingQuality = CompositingQuality.GammaCorrected;

                Size      textArea = StringUtil.MeasureText(Text, Font, graphics);
                Rectangle group    = ConfigureStyleBox(textArea);
                Rectangle title    = ConfigureStyleTitleBox(textArea);

                _titleBoxRectangle = new Rectangle(title.X, title.Y, title.Width - 1, title.Height);

                Rectangle _clientRectangle = new Rectangle(group.X, group.Y, group.Width, group.Height);
                ControlGraphicsPath = VisualBorderRenderer.CreateBorderTypePath(_clientRectangle, _border);
                graphics.FillRectangle(new SolidBrush(BackColor), _clientRectangle);

                Color _backColor = Enabled ? BackColorState.Enabled : BackColorState.Disabled;
                VisualBackgroundRenderer.DrawBackground(e.Graphics, _backColor, BackgroundImage, MouseState, group, Border);

                if (_borderEdge.Visible)
                {
                    _borderEdge.Location = new Point(_titleBoxRectangle.X + _border.Thickness, _titleBoxRectangle.Bottom);
                    _borderEdge.Size     = new Size(Width - _border.Thickness - 1, 1);
                }

                VisualBorderRenderer.DrawBorderStyle(e.Graphics, _border, ControlGraphicsPath, MouseState);

                if (_boxStyle == GroupBoxStyle.Classic)
                {
                    Size _newSize;
                    if (_image != null)
                    {
                        _newSize = _image.Size;
                    }
                    else
                    {
                        _newSize = new Size(0, 0);
                    }

                    _titleBoxRectangle = new Rectangle(5, 0, title.Width - 1, title.Height);
                    Point _titleBoxBackground = RelationManager.GetTextImageRelationLocation(graphics, _textImageRelation, new Rectangle(new Point(0, 0), _newSize), Text, Font, _titleBoxRectangle, Relation.Text);
                    graphics.FillRectangle(new SolidBrush(BackColorState.Enabled), new Rectangle(new Point(_titleBoxBackground.X, _titleBoxBackground.Y), new Size(_titleBoxRectangle.Width, _titleBoxRectangle.Height)));
                }

                if (_image != null)
                {
                    VisualControlRenderer.DrawContent(e.Graphics, _titleBoxRectangle, Text, Font, ForeColor, _image, _image.Size, _textImageRelation);
                }
                else
                {
                    StringFormat _stringFormat = new StringFormat {
                        Alignment = _textAlignment, LineAlignment = _textLineAlignment
                    };

                    VisualTextRenderer.RenderText(e.Graphics, _titleBoxRectangle, Text, Font, ForeColor, _stringFormat);
                }
            }
            catch (Exception exception)
            {
                Logger.WriteDebug(exception);
            }
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            Graphics graphics = e.Graphics;

            graphics.SmoothingMode = SmoothingMode.HighQuality;
            GraphicsPath controlGraphicsPath;

            switch (_pickType)
            {
            case PickerType.Rectangle:
            {
                _border.HoverVisible = false;

                _graphicsBuffer.FillRectangle(_spectrumGradient, ClientRectangle);
                _graphicsBuffer.FillRectangle(_blackBottomGradient, 0, (Height * 0.7f) + 1, Width, Height * 0.3f);
                _graphicsBuffer.FillRectangle(_whiteTopGradient, 0, 0, Width, Height * 0.3f);
                e.Graphics.DrawImageUnscaled(_canvas, Point.Empty);

                controlGraphicsPath = new GraphicsPath();
                controlGraphicsPath.AddRectangle(new RectangleF(ClientRectangle.Location, new Size(Width - 1, Height - 1)));
                break;
            }

            case PickerType.Wheel:
            {
                OnPaintBackground(e);

                // If the parent is using a transparent colorManager, it's likely to be something like a TabPage in a tab control
                // so we'll draw the parent background instead, to avoid having an ugly solid colorManager
                if ((BackgroundImage == null) && (Parent != null) && ((BackColor == Parent.BackColor) || (Parent.BackColor.A != 255)))
                {
                    ButtonRenderer.DrawParentBackground(e.Graphics, DisplayRectangle, this);
                }

                if (_brush != null)
                {
                    e.Graphics.FillPie(_brush, ClientRectangle, 0, 360);
                }

                // Smooth out the edge of the wheel.
                e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
                using (Pen pen = new Pen(BackColor, 2))
                {
                    e.Graphics.DrawEllipse(pen, new RectangleF(_centerPoint.X - _radius, _centerPoint.Y - _radius, _radius * 2, _radius * 2));
                }

                Point pointLocation = new Point(Convert.ToInt32(_centerPoint.X - _radius), Convert.ToInt32(_centerPoint.Y - _radius));
                Size  newSize       = new Size(Convert.ToInt32(_radius * 2), Convert.ToInt32(_radius * 2));

                controlGraphicsPath = new GraphicsPath();
                controlGraphicsPath.AddEllipse(new RectangleF(pointLocation, newSize));

                break;
            }

            default:
                throw new ArgumentOutOfRangeException();
            }

            VisualBorderRenderer.DrawBorderStyle(graphics, _border, controlGraphicsPath, MouseState);

            // Draws the button
            if (!Color.IsEmpty && _pickerVisible)
            {
                DrawColorPicker(e, HslManager, _drawFocusRectangle);
            }
        }
Beispiel #29
0
        protected override void OnPaint(PaintEventArgs e)
        {
            Graphics _graphics = e.Graphics;

            _graphics.Clear(Parent.BackColor);
            _graphics.SmoothingMode      = SmoothingMode.HighQuality;
            _graphics.CompositingMode    = CompositingMode.SourceOver;
            _graphics.CompositingQuality = CompositingQuality.Default;
            _graphics.InterpolationMode  = InterpolationMode.Default;
            _graphics.PixelOffsetMode    = PixelOffsetMode.Default;
            _graphics.SmoothingMode      = SmoothingMode.HighQuality;
            _graphics.TextRenderingHint  = _textRendererHint;

            Rectangle _clientRectangle = new Rectangle(ClientRectangle.X - 1, ClientRectangle.Y - 1, ClientRectangle.Width + 1, ClientRectangle.Height + 1);

            _graphics.FillRectangle(new SolidBrush(BackColor), _clientRectangle);

            VisualBackgroundRenderer.DrawBackground(e.Graphics, _tabMenu, BackgroundImage, _mouseState, ClientRectangle, _border);

            for (var tabIndex = 0; tabIndex <= TabCount - 1; tabIndex++)
            {
                ConfigureAlignmentStyle(tabIndex);

                // Draws the TabSelector
                Rectangle selectorRectangle  = GDI.ApplyAnchor(_selectorAlignment, GetTabRect(tabIndex), _selectorThickness);
                Rectangle selectorRectangle2 = GDI.ApplyAnchor(SelectorAlignment2, GetTabRect(tabIndex), _selectorThickness);

                StringFormat stringFormat = new StringFormat
                {
                    Alignment     = _textAlignment,
                    LineAlignment = _lineAlignment
                };

                if (tabIndex == SelectedIndex)
                {
                    // Draw selected tab
                    _graphics.FillRectangle(new SolidBrush(_tabSelected), _tabPageRectangle);

                    // Draw tab selector
                    if (_selectorVisible)
                    {
                        _graphics.FillRectangle(new SolidBrush(_tabSelector), selectorRectangle);
                    }

                    if (_selectorVisible2)
                    {
                        _graphics.FillRectangle(new SolidBrush(_tabSelector), selectorRectangle2);
                    }

                    GraphicsPath borderPath = new GraphicsPath();
                    borderPath.AddRectangle(_tabPageRectangle);

                    VisualBorderRenderer.DrawBorder(_graphics, _tabPageRectangle, _tabPageBorder.Color, _tabPageBorder.Thickness);

                    if (_arrowSelectorVisible)
                    {
                        DrawSelectionArrow(e, _tabPageRectangle);
                    }

                    // Draw selected tab text
                    _graphics.DrawString(
                        TabPages[tabIndex].Text,
                        Font,
                        new SolidBrush(_textSelected),
                        _textRectangle,
                        stringFormat);

                    // Draw image list
                    if (ImageList != null)
                    {
                        _graphics.DrawImage(ImageList.Images[tabIndex], _tabPageRectangle.X + 12, _tabPageRectangle.Y + 11, ImageList.Images[tabIndex].Size.Height, ImageList.Images[tabIndex].Size.Width);
                    }
                }
                else
                {
                    // Draw other TabPages
                    _graphics.FillRectangle(new SolidBrush(_tabNormal), _tabPageRectangle);

                    if ((State == MouseStates.Hover) && _tabPageRectangle.Contains(_mouseLocation))
                    {
                        Cursor = Cursors.Hand;

                        // Draw hover background
                        _graphics.FillRectangle(new SolidBrush(_tabHover), _tabPageRectangle);

                        // Draw tab selector
                        if (_selectorVisible)
                        {
                            _graphics.FillRectangle(new SolidBrush(_tabSelector), selectorRectangle);
                        }

                        if (_selectorVisible2)
                        {
                            _graphics.FillRectangle(new SolidBrush(_tabSelector), selectorRectangle2);
                        }

                        GraphicsPath borderPath = new GraphicsPath();
                        borderPath.AddRectangle(_tabPageRectangle);

                        VisualBorderRenderer.DrawBorder(_graphics, _tabPageRectangle, _tabPageBorder.Color, _tabPageBorder.Thickness);
                    }

                    _graphics.DrawString(
                        TabPages[tabIndex].Text,
                        Font,
                        new SolidBrush(_textNormal),
                        _textRectangle,
                        stringFormat);

                    // Draw image list
                    if (ImageList != null)
                    {
                        _graphics.DrawImage(ImageList.Images[tabIndex], _tabPageRectangle.X + 12, _tabPageRectangle.Y + 11, ImageList.Images[tabIndex].Size.Height, ImageList.Images[tabIndex].Size.Width);
                    }
                }
            }

            DrawSeparator(e);
        }