/// <summary>
 /// Draw the scroll next button
 /// </summary>
 /// <param name="bounds">button bounds</param>
 /// <param name="state">flag indicating the state of the button</param>
 /// <param name="graphics">graphics</param>
 public abstract void DrawScrollNextButton(Rectangle bounds, zButtonState state, Graphics graphics);
Exemplo n.º 2
0
 /// <summary>
 /// Draw the scroll next button
 /// </summary>
 /// <param name="bounds">button bounds</param>
 /// <param name="state">flag indicating the state of the button</param>
 /// <param name="graphics">graphics</param>
 public abstract void DrawScrollNextButton(Rectangle bounds, zButtonState state, Graphics graphics);
Exemplo n.º 3
0
        /// <summary>
        /// Draw the scroll next button
        /// </summary>
        /// <param name="bounds">button bounds</param>
        /// <param name="state">flag indicating the state of the button</param>
        /// <param name="graphics">graphics</param>
        public override void DrawScrollNextButton(Rectangle bounds, zButtonState state, Graphics graphics)
        {
            int x1 = bounds.Left + 5;
            int y1 = bounds.Top + bounds.Height / 2 + 2;

            int x2 = x1 - 5;
            int y2 = y1 - 5;

            int x3 = x2;
            int y3 = y1 + 4;

            using (GraphicsPath arrowHeadPath = new GraphicsPath())
            {
                arrowHeadPath.AddLine(x1, y1 - 1, x2, y2 - 1);
                arrowHeadPath.AddLine(x2, y2 - 1, x3, y3 + 1);
                arrowHeadPath.CloseFigure();

                switch (state)
                {
                case zButtonState.Normal:
                    graphics.FillPath(Brushes.LightSteelBlue, arrowHeadPath);

                    graphics.DrawLine(Pens.DarkBlue, x1, y1 - 1, x2, y2 - 1);
                    graphics.DrawLine(Pens.DarkBlue, x2, y2 - 1, x3, y3 + 1);
                    graphics.DrawLine(Pens.White, x3, y3 + 1, x1, y1 + 1);

                    break;

                case zButtonState.Focus:
                    graphics.FillPath(Brushes.LightGreen, arrowHeadPath);

                    graphics.DrawLine(Pens.Blue, x1, y1 - 1, x2, y2 - 1);
                    graphics.DrawLine(Pens.Blue, x2, y2 - 1, x3, y3 + 1);
                    graphics.DrawLine(Pens.White, x3, y3 + 1, x1, y1 + 1);

                    break;

                case zButtonState.Pressed:
                    graphics.FillPath(Brushes.LightSteelBlue, arrowHeadPath);

                    graphics.DrawLine(Pens.DarkBlue, x3, y3 + 1, x1, y1 + 1);
                    graphics.DrawLine(Pens.DarkBlue, x2, y2 - 1, x3, y3 + 1);
                    graphics.DrawLine(Pens.WhiteSmoke, x1, y1 - 1, x2, y2 - 1);

                    break;

                case zButtonState.UnderMouseCursor:
                    graphics.FillPath(Brushes.LightSteelBlue, arrowHeadPath);

                    graphics.DrawLine(Pens.Blue, x1, y1 - 1, x2, y2 - 1);
                    graphics.DrawLine(Pens.Blue, x2, y2 - 1, x3, y3 + 1);
                    graphics.DrawLine(Pens.White, x3, y3 + 1, x1, y1 + 1);

                    break;

                case zButtonState.Disabled:
                    graphics.FillPath(Brushes.Gray, arrowHeadPath);

                    graphics.DrawLine(Pens.DarkGray, x1, y1 - 1, x2, y2 - 1);
                    graphics.DrawLine(Pens.DarkGray, x2, y2 - 1, x3, y3 + 1);
                    graphics.DrawLine(Pens.White, x3, y3 + 1, x1, y1 + 1);

                    break;
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Draw the scroll next button
        /// </summary>
        /// <param name="bounds">button bounds</param>
        /// <param name="state">flag indicating the state of the button</param>
        /// <param name="graphics">graphics</param>
        public override void DrawScrollNextButton(Rectangle bounds, zButtonState state, Graphics graphics)
        {
            int x1 = bounds.Left + bounds.Width / 2 + 1;
             int y1 = bounds.Bottom - 5;

             int y2 = y1 - 4;
             int x2 = x1 - 4;

             int y3 = y2;
             int x3 = x1 + 4;

             using (GraphicsPath arrowHeadPath = new GraphicsPath())
             {
            arrowHeadPath.AddLine(x1, y1, x2, y2);
            arrowHeadPath.AddLine(x2, y2, x3, y3);
            arrowHeadPath.CloseFigure();

            switch (state)
            {
               case zButtonState.Normal:
                  graphics.FillPath(Brushes.LightSteelBlue, arrowHeadPath);

                  //graphics.DrawLine(Pens.DarkBlue, x1, y1 - 1, x2, y2 - 1);
                  //graphics.DrawLine(Pens.DarkBlue, x2, y2 - 1, x3, y3 + 1);
                  //graphics.DrawLine(Pens.White, x3, y3 + 1, x1, y1 + 1);

                  break;

               case zButtonState.Focus:
                  graphics.FillPath(Brushes.LightGreen, arrowHeadPath);

                  //graphics.DrawLine(Pens.Blue, x1, y1 - 1, x2, y2 - 1);
                  //graphics.DrawLine(Pens.Blue, x2, y2 - 1, x3, y3 + 1);
                  //graphics.DrawLine(Pens.White, x3, y3 + 1, x1, y1 + 1);

                  break;

               case zButtonState.Pressed:
                  graphics.FillPath(Brushes.LightSteelBlue, arrowHeadPath);

                  //graphics.DrawLine(Pens.DarkBlue, x3, y3 + 1, x1, y1 + 1);
                  //graphics.DrawLine(Pens.DarkBlue, x2, y2 - 1, x3, y3 + 1);
                  //graphics.DrawLine(Pens.WhiteSmoke, x1, y1 - 1, x2, y2 - 1);

                  break;

               case zButtonState.UnderMouseCursor:
                  graphics.FillPath(Brushes.LightSteelBlue, arrowHeadPath);

                  //graphics.DrawLine(Pens.Blue, x1, y1 - 1, x2, y2 - 1);
                  //graphics.DrawLine(Pens.Blue, x2, y2 - 1, x3, y3 + 1);
                  //graphics.DrawLine(Pens.White, x3, y3 + 1, x1, y1 + 1);

                  break;

               case zButtonState.Disabled:
                  graphics.FillPath(Brushes.Gray, arrowHeadPath);

                  //graphics.DrawLine(Pens.DarkGray, x1, y1 - 1, x2, y2 - 1);
                  //graphics.DrawLine(Pens.DarkGray, x2, y2 - 1, x3, y3 + 1);
                  //graphics.DrawLine(Pens.White, x3, y3 + 1, x1, y1 + 1);

                  break;
            }
             }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Occurs when paint is required
        /// </summary>
        /// <param name="e">event argument</param>
        protected override void OnPaint(PaintEventArgs e)
        {
            if (_clientBounds != ClientRectangle || _updatePositionsOnDraw)
            {
                _clientBounds          = ClientRectangle;
                _updatePositionsOnDraw = false;

                UpdatePositions(e.Graphics, false);
            }

            OnPaintPanelBackground(e);


            if (CaptionButtonsCount > 0)
            {
                OnDrawCaptionButtons(_captionButtonsBounds, e.Graphics);
            }

            DrawRoundBorder(e);

            int buttonsCount = _buttons.Count;

            if (buttonsCount == 1 && ShowOneTabButton == false)
            {
                buttonsCount = 0;
            }

            if (buttonsCount > 0)
            {
                DrawButtonsLine(e);

                RectangleF clip = e.Graphics.ClipBounds;

                e.Graphics.SetClip(_buttonsPanelBounds);

                for (int index = buttonsCount - 1; index >= 0; index--)
                {
                    if (index != SelectedIndex)
                    {
                        _buttons[index].Draw(ButtonsRenderer, false, Font, e.Graphics);
                    }
                }

                _buttons[SelectedIndex].Draw(ButtonsRenderer, true, Font, e.Graphics);

                e.Graphics.SetClip(clip);
            }


            if (_hasScrolls && buttonsCount > 1)
            {
                zButtonState stateBack = zButtonState.Normal;
                zButtonState stateNext = zButtonState.Normal;
                if (_firstShownButtonIndex == 0)
                {
                    stateBack = zButtonState.Disabled;
                }
                else if (IsMouseDownInScrollBackButton)
                {
                    stateBack = zButtonState.Pressed | zButtonState.UnderMouseCursor;
                }
                else if (IsMouseOverScrollBackButton)
                {
                    stateBack = zButtonState.UnderMouseCursor;
                }
                else if (IsMouseDownInScrollNextButton)
                {
                    stateNext = zButtonState.Pressed | zButtonState.UnderMouseCursor;
                }
                else if (IsMouseOverScrollNextButton)
                {
                    stateNext = zButtonState.UnderMouseCursor;
                }

                if (_canScrollNext == false)
                {
                    stateNext = zButtonState.Disabled;
                }

                ButtonsRenderer.DrawScrollBackButton(_scrollBackBounds, stateBack, e.Graphics);
                ButtonsRenderer.DrawScrollNextButton(_scrollNextBounds, stateNext, e.Graphics);
            }

            base.OnPaint(e);
        }