示例#1
0
        private void DrawButton(Graphics graphics, Rectangle buttonRectangle)
        {
            if (_buttonVisible)
            {
                Point _buttonImageLocation;
                Size  _buttonImageSize;

                switch (_buttonStyles)
                {
                case DropDownButtons.Arrow:
                {
                    _buttonImageSize     = new Size(10, 8);
                    _buttonImageLocation = new Point((buttonRectangle.X + (buttonRectangle.Width / 2)) - (_buttonImageSize.Width / 2), (buttonRectangle.Y + (buttonRectangle.Height / 2)) - (_buttonImageSize.Height / 2));
                    GDI.DrawTriangle(graphics, new Rectangle(_buttonImageLocation, _buttonImageSize), new SolidBrush(_buttonColor), false);
                    break;
                }

                case DropDownButtons.Bars:
                {
                    _buttonImageSize     = new Size(18, 10);
                    _buttonImageLocation = new Point((buttonRectangle.X + (buttonRectangle.Width / 2)) - (_buttonImageSize.Width / 2), (buttonRectangle.Y + (buttonRectangle.Height / 2)) - _buttonImageSize.Height);
                    Bars.DrawBars(graphics, _buttonImageLocation, _buttonImageSize, _buttonColor, 3, 5);
                    break;
                }
                }
            }
        }
示例#2
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));
                GraphicsManager.DrawTriangle(graphics, new Rectangle(_buttonImageLocation, _buttonImageSize), new SolidBrush(_buttonColor), false);

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