Esempio n. 1
0
        /// <summary>Draws the button.</summary>
        /// <param name="graphics">The graphics to draw on.</param>
        /// <param name="rectangle">The rectangle to draw on.</param>
        private void DrawButton(Graphics graphics, Rectangle rectangle)
        {
            if (!_buttonVisible)
            {
                return;
            }

            Point _buttonImageLocation;
            Size  _buttonImageSize;

            switch (_buttonStyle)
            {
            case ButtonStyles.Arrow:
            {
                _buttonImageSize     = new Size(10, 6);
                _buttonImageLocation = new Point((rectangle.X + (rectangle.Width / 2)) - (_buttonImageSize.Width / 2), (rectangle.Y + (rectangle.Height / 2)) - (_buttonImageSize.Height / 2));
                VisualElementRenderer.RenderTriangle(graphics, new Rectangle(_buttonImageLocation, _buttonImageSize), _buttonColor, Alignment.Vertical.Down);

                break;
            }

            case ButtonStyles.Bars:
            {
                _buttonImageSize     = new Size(18, 10);
                _buttonImageLocation = new Point((rectangle.X + (rectangle.Width / 2)) - (_buttonImageSize.Width / 2), (rectangle.Y + (rectangle.Height / 2)) - _buttonImageSize.Height);
                VisualElementRenderer.RenderBars(graphics, _buttonImageLocation, _buttonImageSize, _buttonColor, 3, 5);

                break;
            }

            case ButtonStyles.Image:
            {
                if (_buttonImage != null)
                {
                    _buttonImageLocation = new Point((rectangle.X + (rectangle.Width / 2)) - (_buttonImage.Width / 2), (rectangle.Y + (rectangle.Height / 2)) - (_buttonImage.Height / 2));
                    graphics.DrawImage(_buttonImage, _buttonImageLocation);
                }

                break;
            }

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