private void DrawButton(Graphics graphics, ScrollButton scrollButton)
 {
     Rectangle buttonBounds = base.GetButtonBounds(scrollButton);
     if (base.Orientation == Orientation.Horizontal)
     {
         buttonBounds.Inflate(-base.itemStrip.ItemSize.Width / 6, -base.itemStrip.ItemSize.Height / 4);
     }
     else
     {
         buttonBounds.Inflate(-base.itemStrip.ItemSize.Width / 4, -base.itemStrip.ItemSize.Height / 6);
     }
     if (base.ActiveButton == scrollButton)
     {
         buttonBounds.Offset(1, 1);
         Size size = (base.Orientation == Orientation.Horizontal) ? new Size(0, 2) : new Size(2, 0);
         buttonBounds.Inflate(size.Width, size.Height);
         graphics.FillRectangle(SelectionBrush, buttonBounds);
         graphics.DrawRectangle(Pens.Black, buttonBounds);
         buttonBounds.Inflate(-size.Width, -size.Height);
     }
     using (GraphicsPath path = ActivityDesignerPaint.GetScrollIndicatorPath(buttonBounds, scrollButton))
     {
         graphics.FillPath(Brushes.Black, path);
         graphics.DrawPath(Pens.Black, path);
     }
 }
 protected Rectangle GetButtonBounds(ScrollButton scrollButton)
 {
     Rectangle empty = Rectangle.Empty;
     empty.Size = this.buttonSize;
     if ((scrollButton == ScrollButton.Left) || (scrollButton == ScrollButton.Up))
     {
         empty.X = this.bounds.X + this.margin.Width;
         empty.Y = this.bounds.Y + this.margin.Height;
         return empty;
     }
     if ((scrollButton == ScrollButton.Right) || (scrollButton == ScrollButton.Down))
     {
         if (this.orientation == System.Windows.Forms.Orientation.Horizontal)
         {
             empty.X = ((this.bounds.X + this.margin.Width) + empty.Size.Width) + this.itemStrip.Size.Width;
             if (empty.X >= this.bounds.Right)
             {
                 empty.X = this.bounds.Right - empty.Size.Width;
             }
             empty.Y = this.bounds.Y + this.margin.Height;
             return empty;
         }
         empty.X = this.bounds.X + this.margin.Width;
         empty.Y = ((this.bounds.Y + this.margin.Height) + empty.Size.Height) + this.itemStrip.Size.Height;
         if (empty.Y >= this.bounds.Bottom)
         {
             empty.Y = this.bounds.Bottom - empty.Size.Height;
         }
     }
     return empty;
 }
Example #3
0
 public ScrollBar(int x, int y, int width, int height)
 {
     GuideColor               = Color.Black;
     Rect                     = new Rectangle(x, y, width, height);
     _rectsDestGuideMiddle    = new Rectangle[2];
     _rectsDestGuideMiddle[0] = new Rectangle(Rect.X + width / 5, Rect.Y + width / 2, width / 4, Rect.Height - width);
     _rectsDestGuideMiddle[1] = new Rectangle(Rect.X + width * 3 / 5, Rect.Y + width / 2, width / 4, Rect.Height - width);
     _buttonUp                = new ScrollButton(Rect.X, Rect.Y, width, (int)(width / 1.22f), "ScrollButton", "ListBoxUp", SpriteEffects.None);
     _buttonUp.OnPressed     += Up_OnPressed;
     _buttonUp.OnReleased    += Up_OnReleased;
     _buttonDown              = new ScrollButton(Rect.X, Rect.Y + height - (int)(width / 1.22f), width, (int)(width / 1.22f), "ScrollButton", "ListBoxUp", SpriteEffects.FlipVertically);
     _buttonDown.OnPressed   += Down_OnPressed;
     _buttonDown.OnReleased  += Down_OnReleased;
     _buttonThumb             = new ScrollThumb(Rect.X, Rect.Y + (int)(width / 1.65f), width, width * 7, height - width * 7 - (int)(width / 0.845f), "Thumb", "Thumb");
     _buttonThumb.OnMoved    += Thumb_OnMoved;
     ButtonsColor             = Color.White;
     _stepForUpDown           = 0;
     _timer                   = new Timer(500);
     _timer.AutoReset         = false;
     _timer.Elapsed          += Timer_Elapsed;
 }
Example #4
0
        public virtual void OnMouseDown(MouseEventArgs e)
        {
            Point pt = new Point(e.X, e.Y);

            if (this.itemStrip.Bounds.Contains(pt))
            {
                this.itemStrip.OnMouseDown(e);
            }
            else
            {
                ScrollButton button = this.HitTest(pt);
                if (button != ScrollButton.Up)
                {
                    int num = ((button == ScrollButton.Left) || (button == ScrollButton.Up)) ? -1 : 1;
                    this.itemStrip.ScrollPosition += num;
                }
                if (e.Button == MouseButtons.Left)
                {
                    this.ActiveButton = button;
                }
            }
        }
Example #5
0
    void Start()
    {
        // cache our variables

        canvas   = scrollCanvas.GetComponent <Canvas> ();                // save canvas
        canvasRT = canvas.GetComponent <RectTransform> ();               // save rect transform

        canvasHeight = canvasRT.rect.height;                             // height of canvas
        canvasWidth  = canvasRT.rect.width;                              // width of canvas

        buttonWidth        = canvasWidth - ((canvasWidth / margin) * 2); // add margin based on factor
        buttonHeight       = canvasHeight / buttonsTotal;                // the button height based on total buttons
        buttonCenterOffset = buttonHeight / 2;                           // center of button

        buttonHeightVector = new Vector3(0f, buttonHeight, 0f);

        // initialize the pool with the names
        for (int i = 0; i < buttonsTotal; i++)
        {
            GameObject   go      = Instantiate(scrollButtonPrefab, scrollCanvas);
            ScrollButton sButton = go.GetComponent <ScrollButton> ();

            // set scale of buttons
            Vector2 dimensions = new Vector2(buttonWidth, buttonHeight);

            // Set intial positions
            float   buttonX   = canvasWidth / 2;                                                // left justified
            float   buttonY   = canvasHeight - i * buttonHeight - buttonCenterOffset;           // height of button
            Vector3 placement = new Vector3(buttonX, buttonY, 0f);

            // Initialize buttons
            sButton.Init(buttonLabels [i], placement, dimensions, canvas);

            scrollButtonPool.Add(go);
            scrollButtons.Add(go);
        }
    }
Example #6
0
 public ArrowElement(ScrollButton sb)
 {
     this.ScrollButton = sb;
     VSElement         = null;
     if (VisualStyleInformation.IsSupportedByOS)   //OSでサポートがなければVisualStyleは設定しない
     {
         if (sb == ScrollButton.Left)
         {
             VSElement = VisualStyleElement.Spin.DownHorizontal.Hot;
         }
         else if (sb == ScrollButton.Right)
         {
             VSElement = VisualStyleElement.Spin.UpHorizontal.Hot;
         }
         else if (sb == ScrollButton.Down)
         {
             VSElement = VisualStyleElement.Spin.Down.Hot;
         }
         else if (sb == ScrollButton.Up)
         {
             VSElement = VisualStyleElement.Spin.Up.Hot;
         }
     }
 }
Example #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="d"></param>
        /// <returns></returns>
        private static ScrollButton DirectionToScrollButton(Direction d)
        {
            ScrollButton sb = ScrollButton.Down;

            switch (d)
            {
            case Direction.Up:
                sb = ScrollButton.Up;
                break;

            case Direction.Down:
                sb = ScrollButton.Down;
                break;

            case Direction.Left:
                sb = ScrollButton.Left;
                break;

            case Direction.Right:
                sb = ScrollButton.Right;
                break;
            }
            return(sb);
        }
Example #8
0
 private void StartScrolling(ScrollButton button)
 {
     this.scrollTimer.Interval = 10; // msec
     this.scrollTimer.Start();
     this.scrollButton = button;
 }
	// Draw a scroll button control.
	public static void DrawScrollButton
				(Graphics graphics, Rectangle rectangle,
				 ScrollButton button, ButtonState state)
			{
				ThemeManager.MainPainter.DrawScrollButton
					(graphics,
					 rectangle.X, rectangle.Y,
					 rectangle.Width, rectangle.Height,
					 button, state,
					 SystemColors.ControlText,
					 SystemColors.Control);
			}
 private Rectangle GetButtonBounds(ScrollButton scrollButton)
 {
     Image leftScrollImage = ActivityPreviewDesignerTheme.LeftScrollImage;
     if ((scrollButton == ScrollButton.Up) || (leftScrollImage == null))
     {
         return Rectangle.Empty;
     }
     System.Drawing.Size size = leftScrollImage.Size;
     size.Height = Math.Min(size.Width, Math.Min(size.Height, this.ItemSize.Height));
     size.Width = Math.Min(size.Width, size.Height);
     int num = (scrollButton == ScrollButton.Left) ? this.bounds.X : (this.bounds.Right - size.Width);
     Rectangle empty = Rectangle.Empty;
     empty.X = num;
     empty.Y = (this.bounds.Y + (this.bounds.Size.Height / 2)) - (size.Height / 2);
     empty.Size = size;
     return empty;
 }
        private Rectangle GetButtonBounds(ScrollButton scrollButton)
        {
            Image scrollButtonImage = ActivityPreviewDesignerTheme.LeftScrollImage;
            if (scrollButton == ScrollButton.Min || scrollButtonImage == null)
                return Rectangle.Empty;

            Size scrollButtonSize = scrollButtonImage.Size;
            scrollButtonSize.Height = Math.Min(scrollButtonSize.Width, Math.Min(scrollButtonSize.Height, ItemSize.Height));
            scrollButtonSize.Width = Math.Min(scrollButtonSize.Width, scrollButtonSize.Height);

            int startLocation = (scrollButton == ScrollButton.Left) ? this.bounds.X : this.bounds.Right - scrollButtonSize.Width;
            Rectangle scrollRectangle = Rectangle.Empty;
            scrollRectangle.X = startLocation;
            scrollRectangle.Y = this.bounds.Y + this.bounds.Size.Height / 2 - scrollButtonSize.Height / 2;
            scrollRectangle.Size = scrollButtonSize;
            return scrollRectangle;
        }
		public static void DrawScrollButton (Graphics graphics, int x, int y, int width, int height, ScrollButton button, ButtonState state) {
			ThemeEngine.Current.CPDrawScrollButton (graphics, new Rectangle(x, y, width, height), button, state);
		}
Example #13
0
 public static void DrawScrollButton(Graphics graphics, Rectangle rectangle, ScrollButton button, ButtonState state)
 {
     throw null;
 }
Example #14
0
 public static void SetScrollButtonToGroup(ScrollButton btn, String group)
 {
     ButtonGroupState.scrollButtonList[group] = btn;
 }
 public static void DrawScrollButton(System.Drawing.Graphics graphics, int x, int y, int width, int height, ScrollButton button, ButtonState state)
 {
 }
 public static void DrawScrollButton(System.Drawing.Graphics graphics, System.Drawing.Rectangle rectangle, ScrollButton button, ButtonState state)
 {
 }
Example #17
0
		public abstract void CPDrawScrollButton (Graphics graphics, Rectangle rectangle, ScrollButton button, ButtonState state);
Example #18
0
		public void DrawScrollButtonPrimitive( Graphics dc, Rectangle area, ButtonState state, ScrollButton scroll_button_type ) {
			Pen pen = ResPool.GetPen( border_normal_dark_color );
			
			Color first_gradient_color = gradient_first_color; 
			Color second_gradient_color = gradient_second_color_nr2;
			
			bool pushed = false;
			
			if ( ( state & ButtonState.Pushed ) == ButtonState.Pushed ) {
				first_gradient_color = pressed_gradient_first_color;
				second_gradient_color = pressed_gradient_second_color;
				pushed = true;
			}
			
			Point[] points = null;
			
			LinearGradientBrush lgbr = null;
			
			switch ( scroll_button_type ) {
				case ScrollButton.Left:
					// FIXME: temporary fix for artefacts, it should use the backcolor of the parent control
					dc.DrawLine( ResPool.GetPen( ColorControl ), area.X, area.Y, area.X, area.Bottom - 1 );
					
					lgbr = new LinearGradientBrush( new Point( area.X + 2, area.Y + 2 ), new Point( area.X + 2, area.Bottom - 2 ), first_gradient_color, second_gradient_color );
					dc.FillRectangle( lgbr, area.X + 2, area.Y + 2, area.Width - 4, area.Height - 2 );
					
					Pen tmp_pen = ResPool.GetPen( pushed ? pressed_inner_border_dark_color : Color.White );
					dc.DrawLine( tmp_pen, area.X + 1, area.Y + 2, area.X + 1, area.Bottom - 2 );
					dc.DrawLine( tmp_pen, area.X + 2, area.Y + 1, area.Right - 2, area.Y + 1 );
					
					tmp_pen = ResPool.GetPen( pushed ? pressed_inner_border_dark_color : inner_border_dark_color );
					dc.DrawLine( tmp_pen, area.Right - 2, area.Y + 2, area.Right - 2, area.Bottom - 2 );
					dc.DrawLine( tmp_pen, area.X + 2, area.Bottom - 2, area.Right - 3, area.Bottom - 2 );
					
					tmp_pen = ResPool.GetPen( edge_top_inner_color );
					dc.DrawLine( tmp_pen, area.X, area.Y + 1, area.X + 1, area.Y );
					dc.DrawLine( tmp_pen, area.X, area.Bottom - 2, area.X + 1, area.Bottom - 1 );
					
					points = new Point[] {
						new Point( area.X + 2, area.Y ),
						new Point( area.Right - 1, area.Y ),
						new Point( area.Right - 1, area.Bottom - 1 ),
						new Point( area.X + 2, area.Bottom - 1 ),
						new Point( area.X, area.Bottom - 3 ),
						new Point( area.X, area.Y + 2 ),
						new Point( area.X + 2, area.Y )
					};
					dc.DrawPolygon( pen, points );
					break;
				case ScrollButton.Right:
					// FIXME: temporary fix for artefacts, it should use the backcolor of the parent control
					dc.DrawLine( ResPool.GetPen( ColorControl ), area.Right - 1, area.Y, area.Right - 1, area.Bottom - 1 );
					
					lgbr = new LinearGradientBrush( new Point( area.X + 2, area.Y + 2 ), new Point( area.X + 2, area.Bottom - 2 ), first_gradient_color, second_gradient_color );
					dc.FillRectangle( lgbr, area.X + 2, area.Y + 2, area.Width - 4, area.Height - 2 );
					
					tmp_pen = ResPool.GetPen( pushed ? pressed_inner_border_dark_color : Color.White );
					dc.DrawLine( tmp_pen, area.X + 1, area.Y + 1, area.X + 1, area.Bottom - 2 );
					dc.DrawLine( tmp_pen, area.X + 2, area.Y + 1, area.Right - 2, area.Y + 1 );
					
					tmp_pen = ResPool.GetPen( pushed ? pressed_inner_border_dark_color : inner_border_dark_color );
					dc.DrawLine( tmp_pen, area.Right - 2, area.Y + 2, area.Right - 2, area.Bottom - 2 );
					dc.DrawLine( tmp_pen, area.X + 2, area.Bottom - 2, area.Right - 3, area.Bottom - 2 );
					
					tmp_pen = ResPool.GetPen( edge_top_inner_color );
					dc.DrawLine( tmp_pen, area.Right - 2, area.Y, area.Right - 1, area.Y + 1 );
					dc.DrawLine( tmp_pen, area.Right - 1, area.Bottom - 2, area.Right - 2, area.Bottom - 1 );
					
					points = new Point[] {
						new Point( area.X, area.Y ),
						new Point( area.Right - 3, area.Y ),
						new Point( area.Right - 1, area.Y + 2 ),
						new Point( area.Right - 1, area.Bottom - 3 ),
						new Point( area.Right - 3, area.Bottom - 1 ),
						new Point( area.X, area.Bottom - 1 ),
						new Point( area.X, area.Y ),
					};
					dc.DrawPolygon( pen, points );
					break;
				case ScrollButton.Up:
					// FIXME: temporary fix for artefacts, it should use the backcolor of the parent control
					dc.DrawLine( ResPool.GetPen( ColorControl ), area.X, area.Y, area.Right - 1, area.Y );
					
					lgbr = new LinearGradientBrush( new Point( area.X + 2, area.Y ), new Point( area.Right - 2, area.Y ), first_gradient_color, second_gradient_color );
					dc.FillRectangle( lgbr, area.X + 2, area.Y + 2, area.Width - 4, area.Height - 4 );
					
					tmp_pen = ResPool.GetPen( pushed ? pressed_inner_border_dark_color : Color.White );
					dc.DrawLine( tmp_pen, area.X + 1, area.Y + 1, area.X + 1, area.Bottom - 2 );
					dc.DrawLine( tmp_pen, area.X + 2, area.Y + 1, area.Right - 2, area.Y + 1 );
					
					tmp_pen = ResPool.GetPen( pushed ? pressed_inner_border_dark_color : inner_border_dark_color );
					dc.DrawLine( tmp_pen, area.Right - 2, area.Y + 2, area.Right - 2, area.Bottom - 2 );
					dc.DrawLine( tmp_pen, area.X + 2, area.Bottom - 2, area.Right - 3, area.Bottom - 2 );
					
					tmp_pen = ResPool.GetPen( edge_top_inner_color );
					dc.DrawLine( tmp_pen, area.X, area.Y + 1, area.X + 1, area.Y );
					dc.DrawLine( tmp_pen, area.Right - 2, area.Y, area.Right - 1, area.Y + 1 );
					
					points = new Point[] {
						new Point( area.X + 2, area.Y ),
						new Point( area.Right - 3, area.Y ),
						new Point( area.Right - 1, area.Y + 2 ),
						new Point( area.Right - 1, area.Bottom - 1 ),
						new Point( area.X, area.Bottom - 1 ),
						new Point( area.X, area.Y + 2 ),
						new Point( area.X + 2, area.Y )
					};
					dc.DrawPolygon( pen, points );
					break;
				case ScrollButton.Down:
					// FIXME: temporary fix for artefacts, it should use the backcolor of the parent control
					dc.DrawLine( ResPool.GetPen( ColorControl ), area.X, area.Bottom - 1, area.Right - 1, area.Bottom - 1 );
					
					lgbr = new LinearGradientBrush( new Point( area.X + 2, area.Y ), new Point( area.Right - 2, area.Y ), first_gradient_color, second_gradient_color );
					dc.FillRectangle( lgbr, area.X + 2, area.Y + 2, area.Width - 4, area.Height - 4 );
					
					tmp_pen = ResPool.GetPen( pushed ? pressed_inner_border_dark_color : Color.White );
					dc.DrawLine( tmp_pen, area.X + 1, area.Y + 1, area.X + 1, area.Bottom - 2 );
					dc.DrawLine( tmp_pen, area.X + 2, area.Y + 1, area.Right - 2, area.Y + 1 );
					
					tmp_pen = ResPool.GetPen( pushed ? pressed_inner_border_dark_color : inner_border_dark_color );
					dc.DrawLine( tmp_pen, area.Right - 2, area.Y + 2, area.Right - 2, area.Bottom - 2 );
					dc.DrawLine( tmp_pen, area.X + 2, area.Bottom - 2, area.Right - 3, area.Bottom - 2 );
					
					tmp_pen = ResPool.GetPen( edge_top_inner_color );
					dc.DrawLine( tmp_pen, area.X, area.Bottom - 2, area.X + 1, area.Bottom - 1 );
					dc.DrawLine( tmp_pen, area.Right - 2, area.Bottom - 1, area.Right - 1, area.Bottom - 2 );
					
					points = new Point[] {
						new Point( area.X, area.Y ),
						new Point( area.Right - 1, area.Y ),
						new Point( area.Right - 1, area.Bottom - 3 ),
						new Point( area.Right - 3, area.Bottom - 1 ),
						new Point( area.X + 2, area.Bottom - 1 ),
						new Point( area.X, area.Bottom - 3 ),
						new Point( area.X, area.Y )
					};
					dc.DrawPolygon( pen, points );
					break;
			}
			
			lgbr.Dispose( );
		}
Example #19
0
		/* Scroll button: regular button + direction arrow */
		public override void CPDrawScrollButton( Graphics dc, Rectangle area, ScrollButton scroll_button_type, ButtonState state ) {
			bool enabled = ( state == ButtonState.Inactive ) ? false: true;
			
			DrawScrollButtonPrimitive( dc, area, state, scroll_button_type );
			
			Color color_arrow;
			
			if ( enabled )
				color_arrow = arrow_color;
			else
				color_arrow = ColorGrayText;
			
			/* Paint arrows */
			
			int centerX = area.Left + area.Width / 2;
			int centerY = area.Top + area.Height / 2;
			
			int shift = 0;
			
			if ( ( state & ButtonState.Pushed ) != 0 )
				shift = 1;
			
			int min_4 = 4;
			int min_2 = 2;
			if ( area.Width < 12 || area.Height < 12 ) {
				min_4 = 3;
				min_2 = 1;
			}
			
			Point[]	arrow = new Point[ 4 ];
			
			switch (scroll_button_type) {
			case ScrollButton.Down:
				centerY += shift + 1;
				arrow [0] = new Point (centerX - min_4, centerY - min_2);
				arrow [1] = new Point (centerX, centerY + min_2);
				arrow [2] = new Point (centerX + min_4, centerY - min_2);
				arrow [3] = new Point (centerX - min_4, centerY - min_2);
				break;
			case ScrollButton.Up:
				centerY -= shift;
				arrow [0] = new Point (centerX - min_4, centerY + min_2);
				arrow [1] = new Point (centerX, centerY - min_2);
				arrow [2] = new Point (centerX + min_4, centerY + min_2);
				arrow [3] = new Point (centerX - min_4, centerY + min_2);
				break;
			case ScrollButton.Left:
				centerX -= shift;
				arrow [0] = new Point (centerX + min_2, centerY - min_4);
				arrow [1] = new Point (centerX + min_2, centerY + min_4);
				arrow [2] = new Point (centerX - min_2, centerY);
				arrow [3] = new Point (centerX + min_2, centerY - min_4);
				break;
			case ScrollButton.Right:
				centerX += shift + 1;
				arrow [0] = new Point (centerX - min_2, centerY - min_4);
				arrow [1] = new Point (centerX + min_2, centerY);
				arrow [2] = new Point (centerX - min_2, centerY + min_4);
				arrow [3] = new Point (centerX - min_2, centerY - min_4);
				break;
			default:
				break;
			}
			
			SmoothingMode old_smoothing_mode = dc.SmoothingMode;
			dc.SmoothingMode = SmoothingMode.AntiAlias;
			dc.FillPolygon( ResPool.GetSolidBrush( color_arrow ), arrow );
			dc.SmoothingMode = old_smoothing_mode;
		}
	public static void DrawScrollButton
				(Graphics graphics, int x, int y, int width, int height,
				 ScrollButton button, ButtonState state)
			{
				ThemeManager.MainPainter.DrawScrollButton
					(graphics,
					 x, y, width, height,
					 button, state,
					 SystemColors.ControlText,
					 SystemColors.Control);
			}
Example #21
0
		/* Scroll button: regular button + direction arrow */
		public override void CPDrawScrollButton (Graphics dc, Rectangle area, ScrollButton type, ButtonState state)
		{
			DrawScrollButtonPrimitive (dc, area, state);
			
			bool fill_rect = true;
			int offset = 0;
			
			if ((state & ButtonState.Pushed) != 0)
				offset = 1;
			
			// skip the border
			Rectangle rect = new Rectangle (area.X + 2 + offset, area.Y + 2 + offset, area.Width - 4, area.Height - 4);
			
			Point [] arrow = new Point [3];
			for (int i = 0; i < 3; i++)
				arrow [i] = new Point ();
			
			Pen pen = SystemPens.ControlText;
			
			if ((state & ButtonState.Inactive) != 0) {
				pen = SystemPens.ControlDark;
			}
			
			switch (type) {
				default:
				case ScrollButton.Down:
					int x_middle = (int)Math.Round (rect.Width / 2.0f) - 1;
					int y_middle = (int)Math.Round (rect.Height / 2.0f) - 1;
					if (x_middle == 1)
						x_middle = 2;
					
					int triangle_height;
					
					if (rect.Height < 8) {
						triangle_height = 2;
						fill_rect = false;
					} else if (rect.Height == 11) {
						triangle_height = 3;
					} else {
						triangle_height = (int)Math.Round (rect.Height / 3.0f);
					}
					
					arrow [0].X = rect.X + x_middle;
					arrow [0].Y = rect.Y + y_middle + triangle_height / 2;
					
					arrow [1].X = arrow [0].X + triangle_height - 1;
					arrow [1].Y = arrow [0].Y - triangle_height + 1;
					arrow [2].X = arrow [0].X - triangle_height + 1;
					arrow [2].Y = arrow [1].Y;
					
					dc.DrawPolygon (pen, arrow);
					
					if ((state & ButtonState.Inactive) != 0) {
						dc.DrawLine (SystemPens.ControlLightLight, arrow [1].X + 1, arrow [1].Y + 1, arrow [0].X + 1, arrow [0].Y + 1);
						dc.DrawLine (SystemPens.ControlLightLight, arrow [1].X, arrow [1].Y + 1, arrow [0].X + 1, arrow [0].Y);
					}
					
					if (fill_rect) {
						for (int i = 0; i < arrow [0].Y - arrow [1].Y; i++) {
							dc.DrawLine (pen, arrow [1].X, arrow [1].Y + i, arrow [2].X, arrow [1].Y + i);
							arrow [1].X -= 1;
							arrow [2].X += 1;
						}
					}
					break;
					
				case ScrollButton.Up:
					x_middle = (int)Math.Round (rect.Width / 2.0f) - 1;
					y_middle = (int)Math.Round (rect.Height / 2.0f);
					if (x_middle == 1)
						x_middle = 2;
					
					if (y_middle == 1)
						y_middle = 2;
					
					if (rect.Height < 8) {
						triangle_height = 2;
						fill_rect = false;
					} else if (rect.Height == 11) {
						triangle_height = 3;
					} else {
						triangle_height = (int)Math.Round (rect.Height / 3.0f);
					}
					
					arrow [0].X = rect.X + x_middle;
					arrow [0].Y = rect.Y + y_middle - triangle_height / 2;
					
					arrow [1].X = arrow [0].X + triangle_height - 1;
					arrow [1].Y = arrow [0].Y + triangle_height - 1;
					arrow [2].X = arrow [0].X - triangle_height + 1;
					arrow [2].Y = arrow [1].Y;
					
					dc.DrawPolygon (pen, arrow);
					
					if ((state & ButtonState.Inactive) != 0) {
						dc.DrawLine (SystemPens.ControlLightLight, arrow [1].X + 1, arrow [1].Y + 1, arrow [2].X + 1, arrow [1].Y + 1);
					}
					
					if (fill_rect) {
						for (int i = 0; i < arrow [1].Y - arrow [0].Y; i++) {
							dc.DrawLine (pen, arrow [2].X, arrow [1].Y - i, arrow [1].X, arrow [1].Y - i);
							arrow [1].X -= 1;
							arrow [2].X += 1;
						}
					}
					break;
					
				case ScrollButton.Left:
					y_middle = (int)Math.Round (rect.Height / 2.0f) - 1;
					if (y_middle == 1)
						y_middle = 2;
					
					int triangle_width;
					
					if (rect.Width < 8) {
						triangle_width = 2;
						fill_rect = false;
					} else if (rect.Width == 11) {
						triangle_width = 3;
					} else {
						triangle_width = (int)Math.Round (rect.Width / 3.0f);
					}
					
					arrow [0].X = rect.Left + triangle_width - 1;
					arrow [0].Y = rect.Y + y_middle;
					
					if (arrow [0].X - 1 == rect.X)
						arrow [0].X += 1;
					
					arrow [1].X = arrow [0].X + triangle_width - 1;
					arrow [1].Y = arrow [0].Y - triangle_width + 1;
					arrow [2].X = arrow [1].X;
					arrow [2].Y = arrow [0].Y + triangle_width - 1;
					
					dc.DrawPolygon (pen, arrow);
					
					if ((state & ButtonState.Inactive) != 0) {
						dc.DrawLine (SystemPens.ControlLightLight, arrow [1].X + 1, arrow [1].Y + 1, arrow [2].X + 1, arrow [2].Y + 1);
					}
					
					if (fill_rect) {
						for (int i = 0; i < arrow [2].X - arrow [0].X; i++) {
							dc.DrawLine (pen, arrow [2].X - i, arrow [1].Y, arrow [2].X - i, arrow [2].Y);
							arrow [1].Y += 1;
							arrow [2].Y -= 1;
						}
					}
					break;
					
				case ScrollButton.Right:
					y_middle = (int)Math.Round (rect.Height / 2.0f) - 1;
					if (y_middle == 1)
						y_middle = 2;
					
					if (rect.Width < 8) {
						triangle_width = 2;
						fill_rect = false;
					} else if (rect.Width == 11) {
						triangle_width = 3;
					} else {
						triangle_width = (int)Math.Round (rect.Width / 3.0f);
					}
					
					arrow [0].X = rect.Right - triangle_width - 1;
					arrow [0].Y = rect.Y + y_middle;
					
					if (arrow [0].X - 1 == rect.X)
						arrow [0].X += 1;
					
					arrow [1].X = arrow [0].X - triangle_width + 1;
					arrow [1].Y = arrow [0].Y - triangle_width + 1;
					arrow [2].X = arrow [1].X;
					arrow [2].Y = arrow [0].Y + triangle_width - 1;
					
					dc.DrawPolygon (pen, arrow);
					
					if ((state & ButtonState.Inactive) != 0) {
						dc.DrawLine (SystemPens.ControlLightLight, arrow [0].X + 1, arrow [0].Y + 1, arrow [2].X + 1, arrow [2].Y + 1);
						dc.DrawLine (SystemPens.ControlLightLight, arrow [0].X, arrow [0].Y + 1, arrow [2].X + 1, arrow [2].Y);
					}
					
					if (fill_rect) {
						for (int i = 0; i < arrow [0].X - arrow [1].X; i++) {
							dc.DrawLine (pen, arrow [2].X + i, arrow [1].Y, arrow [2].X + i, arrow [2].Y);
							arrow [1].Y += 1;
							arrow [2].Y -= 1;
						}
					}
					break;
			}
		}
 public static void DrawScrollButton(Graphics graphics, Rectangle rectangle, ScrollButton button, ButtonState state)
 {
     DrawScrollButton(graphics, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, button, state);
 }
Example #23
0
		protected virtual void DrawScrollButton (Graphics dc, Rectangle bounds, Rectangle clippingArea, ScrollButton button, PushButtonState state)
		{
			ControlPaint.DrawScrollButton (dc, bounds, button, GetButtonState (state));
		}
Example #24
0
 public ArrowElement(ScrollButton sb)
 {
     this.ScrollButton = sb;
     VSElement = null;
     if (VisualStyleInformation.IsSupportedByOS) { //OSでサポートがなければVisualStyleは設定しない
         if (sb == ScrollButton.Left)
             VSElement = VisualStyleElement.Spin.DownHorizontal.Hot;
         else if (sb == ScrollButton.Right)
             VSElement = VisualStyleElement.Spin.UpHorizontal.Hot;
         else if (sb == ScrollButton.Down)
             VSElement = VisualStyleElement.Spin.Down.Hot;
         else if (sb == ScrollButton.Up)
             VSElement = VisualStyleElement.Spin.Up.Hot;
     }
 }
 internal static GraphicsPath GetScrollIndicatorPath(Rectangle bounds, ScrollButton button)
 {
     GraphicsPath path = new GraphicsPath();
     if (!bounds.IsEmpty)
     {
         if ((button == ScrollButton.Left) || (button == ScrollButton.Right))
         {
             int height = bounds.Height + (bounds.Height % 2);
             int num2 = height / 2;
             Size size = new Size(height / 2, height);
             if (button == ScrollButton.Right)
             {
                 path.AddLine(bounds.Left + ((bounds.Width - size.Width) / 2), bounds.Top, bounds.Left + ((bounds.Width - size.Width) / 2), bounds.Top + size.Height);
                 path.AddLine((int) (bounds.Left + ((bounds.Width - size.Width) / 2)), (int) (bounds.Top + size.Height), (int) ((bounds.Left + ((bounds.Width - size.Width) / 2)) + size.Width), (int) (bounds.Top + num2));
                 path.AddLine((bounds.Left + ((bounds.Width - size.Width) / 2)) + size.Width, bounds.Top + num2, bounds.Left + ((bounds.Width - size.Width) / 2), bounds.Top);
             }
             else
             {
                 path.AddLine((int) (bounds.Left + ((bounds.Width - size.Width) / 2)), (int) (bounds.Top + num2), (int) ((bounds.Left + ((bounds.Width - size.Width) / 2)) + size.Width), (int) (bounds.Top + size.Height));
                 path.AddLine((bounds.Left + ((bounds.Width - size.Width) / 2)) + size.Width, bounds.Top + size.Height, (bounds.Left + ((bounds.Width - size.Width) / 2)) + size.Width, bounds.Top);
                 path.AddLine((bounds.Left + ((bounds.Width - size.Width) / 2)) + size.Width, bounds.Top, bounds.Left + ((bounds.Width - size.Width) / 2), bounds.Top + num2);
             }
         }
         else if ((button == ScrollButton.Up) || (button == ScrollButton.Down))
         {
             int width = bounds.Width + (bounds.Width % 2);
             int num4 = width / 2;
             Size size2 = new Size(width, width / 2);
             if (button == ScrollButton.Down)
             {
                 path.AddLine(bounds.Left, bounds.Top + ((bounds.Height - size2.Height) / 2), bounds.Left + size2.Width, bounds.Top + ((bounds.Height - size2.Height) / 2));
                 path.AddLine((int) (bounds.Left + size2.Width), (int) (bounds.Top + ((bounds.Height - size2.Height) / 2)), (int) (bounds.Left + num4), (int) ((bounds.Top + ((bounds.Height - size2.Height) / 2)) + size2.Height));
                 path.AddLine(bounds.Left + num4, (bounds.Top + ((bounds.Height - size2.Height) / 2)) + size2.Height, bounds.Left, bounds.Top + ((bounds.Height - size2.Height) / 2));
             }
             else
             {
                 path.AddLine((int) (bounds.Left + num4), (int) (bounds.Top + ((bounds.Height - size2.Height) / 2)), (int) (bounds.Left + size2.Width), (int) ((bounds.Top + ((bounds.Height - size2.Height) / 2)) + size2.Height));
                 path.AddLine(bounds.Left + size2.Width, (bounds.Top + ((bounds.Height - size2.Height) / 2)) + size2.Height, bounds.Left, (bounds.Top + ((bounds.Height - size2.Height) / 2)) + size2.Height);
                 path.AddLine(bounds.Left, (bounds.Top + ((bounds.Height - size2.Height) / 2)) + size2.Height, bounds.Left + num4, bounds.Top + ((bounds.Height - size2.Height) / 2));
             }
         }
     }
     path.CloseFigure();
     return path;
 }
Example #26
0
 public static void DrawScrollButton(Graphics graphics, int x, int y, int width, int height, ScrollButton button, ButtonState state)
 {
     throw null;
 }
Example #27
0
 public ArrowElement(ScrollButton sb)
 {
     this.ScrollButton = sb;
     VSElement = null;
     if (VisualStyleInformation.IsSupportedByOS) { //OS�ŃT�|�[�g���Ȃ����VisualStyle�͐ݒ肵�Ȃ�
         if (sb == ScrollButton.Left)
             VSElement = VisualStyleElement.Spin.DownHorizontal.Hot;
         else if (sb == ScrollButton.Right)
             VSElement = VisualStyleElement.Spin.UpHorizontal.Hot;
         else if (sb == ScrollButton.Down)
             VSElement = VisualStyleElement.Spin.Down.Hot;
         else if (sb == ScrollButton.Up)
             VSElement = VisualStyleElement.Spin.Up.Hot;
     }
 }
		public static void DrawScrollButton (Graphics graphics, Rectangle rectangle, ScrollButton button, ButtonState state) {
			ThemeEngine.Current.CPDrawScrollButton (graphics, rectangle, button, state);
		}
	public static void DrawScrollButton(System.Drawing.Graphics graphics, int x, int y, int width, int height, ScrollButton button, ButtonState state) {}
        protected Rectangle GetButtonBounds(ScrollButton scrollButton)
        {
            Rectangle buttonRectangle = Rectangle.Empty;
            buttonRectangle.Size = this.buttonSize;

            if (scrollButton == ScrollButton.Left || scrollButton == ScrollButton.Up)
            {
                buttonRectangle.X = this.bounds.X + this.margin.Width;
                buttonRectangle.Y = this.bounds.Y + this.margin.Height;
            }
            else if (scrollButton == ScrollButton.Right || scrollButton == ScrollButton.Down)
            {
                if (this.orientation == Orientation.Horizontal)
                {
                    buttonRectangle.X = this.bounds.X + this.margin.Width + buttonRectangle.Size.Width + this.itemStrip.Size.Width;
                    if (buttonRectangle.X >= this.bounds.Right)
                        buttonRectangle.X = this.bounds.Right - buttonRectangle.Size.Width;

                    buttonRectangle.Y = this.bounds.Y + this.margin.Height;
                }
                else
                {
                    buttonRectangle.X = this.bounds.X + this.margin.Width;

                    buttonRectangle.Y = this.bounds.Y + this.margin.Height + buttonRectangle.Size.Height + this.itemStrip.Size.Height;
                    if (buttonRectangle.Y >= this.bounds.Bottom)
                        buttonRectangle.Y = this.bounds.Bottom - buttonRectangle.Size.Height;
                }
            }

            return buttonRectangle;
        }
		static VisualStyleElement GetScrollButtonVisualStyleElement (ScrollButton type, ButtonState state)
		{
			switch (type) {
			case ScrollButton.Left:
				if (IsDisabled (state))
					return VisualStyleElement.ScrollBar.ArrowButton.LeftDisabled;
				else if (IsPressed (state))
					return VisualStyleElement.ScrollBar.ArrowButton.LeftPressed;
				else
					return VisualStyleElement.ScrollBar.ArrowButton.LeftNormal;
			case ScrollButton.Right:
				if (IsDisabled (state))
					return VisualStyleElement.ScrollBar.ArrowButton.RightDisabled;
				else if (IsPressed (state))
					return VisualStyleElement.ScrollBar.ArrowButton.RightPressed;
				else
					return VisualStyleElement.ScrollBar.ArrowButton.RightNormal;
			case ScrollButton.Up:
				if (IsDisabled (state))
					return VisualStyleElement.ScrollBar.ArrowButton.UpDisabled;
				else if (IsPressed (state))
					return VisualStyleElement.ScrollBar.ArrowButton.UpPressed;
				else
					return VisualStyleElement.ScrollBar.ArrowButton.UpNormal;
			default:
				if (IsDisabled (state))
					return VisualStyleElement.ScrollBar.ArrowButton.DownDisabled;
				else if (IsPressed (state))
					return VisualStyleElement.ScrollBar.ArrowButton.DownPressed;
				else
					return VisualStyleElement.ScrollBar.ArrowButton.DownNormal;
			}
		}
Example #32
0
 protected virtual void DrawScrollButton(Graphics dc, Rectangle bounds, Rectangle clippingArea, ScrollButton button, PushButtonState state)
 {
     ControlPaint.DrawScrollButton(dc, bounds, button, GetButtonState(state));
 }
		protected override void DrawScrollButton (Graphics dc, Rectangle bounds, Rectangle clippingArea, ScrollButton button, PushButtonState state)
		{
			if (!ThemeVisualStyles.RenderClientAreas) {
				base.DrawScrollButton (dc, bounds, clippingArea, button, state);
				return;
			}
			VisualStyleElement element;
			if (button == ScrollButton.Left)
				switch (state) {
				case PushButtonState.Hot:
					element = VisualStyleElement.Spin.DownHorizontal.Hot;
					break;
				case PushButtonState.Pressed:
					element = VisualStyleElement.Spin.DownHorizontal.Pressed;
					break;
				default:
					element = VisualStyleElement.Spin.DownHorizontal.Normal;
					break;
				}
			else
				switch (state) {
				case PushButtonState.Hot:
					element = VisualStyleElement.Spin.UpHorizontal.Hot;
					break;
				case PushButtonState.Pressed:
					element = VisualStyleElement.Spin.UpHorizontal.Pressed;
					break;
				default:
					element = VisualStyleElement.Spin.UpHorizontal.Normal;
					break;
				}
			if (!VisualStyleRenderer.IsElementDefined (element)) {
				if (button == ScrollButton.Left)
					switch (state) {
					case PushButtonState.Hot:
						element = VisualStyleElement.ScrollBar.ArrowButton.LeftHot;
						break;
					case PushButtonState.Pressed:
						element = VisualStyleElement.ScrollBar.ArrowButton.LeftPressed;
						break;
					default:
						element = VisualStyleElement.ScrollBar.ArrowButton.LeftNormal;
						break;
					}
				else
					switch (state) {
					case PushButtonState.Hot:
						element = VisualStyleElement.ScrollBar.ArrowButton.RightHot;
						break;
					case PushButtonState.Pressed:
						element = VisualStyleElement.ScrollBar.ArrowButton.RightPressed;
						break;
					default:
						element = VisualStyleElement.ScrollBar.ArrowButton.RightNormal;
						break;
					}
				if (!VisualStyleRenderer.IsElementDefined (element)) {
					base.DrawScrollButton (dc, bounds, clippingArea, button, state);
					return;
				}
			}
			new VisualStyleRenderer (element).DrawBackground (dc, bounds, clippingArea);
		}
Example #34
0
 protected override void DisposeOther()
 {
     OnScrollValueChanged = null;
     base.DisposeOther();
     ScrollButton.Dispose();
 }
 public static void DrawScrollButton(Graphics graphics, int x, int y, int width, int height, ScrollButton button, ButtonState state)
 {
     ThemeEngine.Current.CPDrawScrollButton(graphics, new Rectangle(x, y, width, height), button, state);
 }
	public static void DrawScrollButton(System.Drawing.Graphics graphics, System.Drawing.Rectangle rectangle, ScrollButton button, ButtonState state) {}
 public static void DrawScrollButton(Graphics graphics, Rectangle rectangle, ScrollButton button, ButtonState state)
 {
     ThemeEngine.Current.CPDrawScrollButton(graphics, rectangle, button, state);
 }
		public override void CPDrawScrollButton (Graphics dc, Rectangle area, ScrollButton type, ButtonState state)
		{
			if (!RenderClientAreas ||
				(state & ButtonState.Flat) == ButtonState.Flat ||
				(state & ButtonState.Checked) == ButtonState.Checked) {
				base.CPDrawScrollButton (dc, area, type, state);
				return;
			}
			VisualStyleElement element = GetScrollButtonVisualStyleElement (type, state);
			if (!VisualStyleRenderer.IsElementDefined (element)) {
				base.CPDrawScrollButton (dc, area, type, state);
				return;
			}
			new VisualStyleRenderer (element).DrawBackground (dc, area);
		}
Example #39
0
		/* Scroll button: regular button + direction arrow */
		public override void CPDrawScrollButton( Graphics dc, Rectangle area, ScrollButton scroll_button_type, ButtonState state )
		{
			bool enabled = ( state == ButtonState.Inactive ) ? false: true;
			
			DrawScrollButtonPrimitive( dc, area, state, scroll_button_type );
			
			Pen pen = null;
			
			if ( enabled )
				pen = ResPool.GetSizedPen( arrow_color, 2 );
			else
				pen = ResPool.GetSizedPen( ColorGrayText, 2 );
			
			/* Paint arrows */
			
			int centerX = area.Left + area.Width / 2;
			int centerY = area.Top + area.Height / 2;
			
			int shift = 0;
			
			if ( ( state & ButtonState.Pushed ) != 0 )
				shift = 1;
			
			int min_3 = 3;
			int min_2 = 2;
			if ( area.Width < 12 || area.Height < 12 ) {
				min_3 = 2;
				min_2 = 1;
			}
			
			Point[]	arrow = new Point [3];
			
			switch (scroll_button_type) {
			case ScrollButton.Down:
				centerY += shift;
				arrow [0] = new Point (centerX - min_3, centerY - min_2);
				arrow [1] = new Point (centerX, centerY + min_2);
				arrow [2] = new Point (centerX + min_3, centerY - min_2);
				break;
			case ScrollButton.Up:
				centerY -= shift;
				arrow [0] = new Point (centerX - min_3, centerY + min_2);
				arrow [1] = new Point (centerX, centerY - min_2);
				arrow [2] = new Point (centerX + min_3, centerY + min_2);
				break;
			case ScrollButton.Left:
				centerX -= shift;
				arrow [0] = new Point (centerX + min_2, centerY - min_3);
				arrow [1] = new Point (centerX - min_2, centerY);
				arrow [2] = new Point (centerX + min_2, centerY + min_3);
				break;
			case ScrollButton.Right:
				centerX += shift;
				arrow [0] = new Point (centerX - min_2, centerY - min_3);
				arrow [1] = new Point (centerX + min_2, centerY);
				arrow [2] = new Point (centerX - min_2, centerY + min_3);
				break;
			default:
				break;
			}

			SmoothingMode old_smoothing_mode = dc.SmoothingMode;
			dc.SmoothingMode = SmoothingMode.AntiAlias;
			
			dc.DrawLines (pen, arrow);
			
			dc.SmoothingMode = old_smoothing_mode;
		}
Example #40
0
 private void StartScrolling(ScrollButton button)
 {
     this.scrollTimer.Interval = 10; // msec
     this.scrollTimer.Start();
     this.scrollButton = button;
 }
Example #41
0
		/* Nice scroll button */
		public void DrawScrollButtonPrimitive( Graphics dc, Rectangle area, ButtonState state, ScrollButton scroll_button_type )
		{
			Pen pen = ResPool.GetPen( BorderColor );
			
			dc.FillRectangle( ResPool.GetSolidBrush( NiceBackColor ), area );
			
			Color use_color;
			
			if ( ( state & ButtonState.Pushed ) == ButtonState.Pushed )
				use_color = PressedColor;
			else
				use_color = NormalColor;
			
			Point[] points = null;
			
			LinearGradientBrush lgbr = null;
			
			switch ( scroll_button_type )
			{
				case ScrollButton.Left:
					lgbr = new LinearGradientBrush( new Point( area.X, area.Y ), new Point( area.Right - 1, area.Y ), use_color, Color.White );
					lgbr.Blend = FlatBlend;
					dc.FillRectangle( lgbr, area.X + 1, area.Y + 1, area.Width - 2, area.Height - 2 );
					
					points = new Point[] {
						new Point( area.X + 2, area.Y ),
						new Point( area.Right - 1, area.Y ),
						new Point( area.Right - 1, area.Bottom - 1 ),
						new Point( area.X + 2, area.Bottom - 1 ),
						new Point( area.X, area.Bottom - 3 ),
						new Point( area.X, area.Y + 2 ),
						new Point( area.X + 2, area.Y )
					};
					dc.DrawPolygon( pen, points );
					break;
				case ScrollButton.Right:
					lgbr = new LinearGradientBrush( new Point( area.X, area.Y ), new Point( area.Right - 1, area.Y ), Color.White, use_color );
					lgbr.Blend = NormalBlend;
					dc.FillRectangle( lgbr, area.X, area.Y + 1, area.Width - 1, area.Height - 2 );
					
					points = new Point[] {
						new Point( area.X, area.Y ),
						new Point( area.Right - 3, area.Y ),
						new Point( area.Right - 1, area.Y + 2 ),
						new Point( area.Right - 1, area.Bottom - 3 ),
						new Point( area.Right - 3, area.Bottom - 1 ),
						new Point( area.X, area.Bottom - 1 ),
						new Point( area.X, area.Y ),
					};
					dc.DrawPolygon( pen, points );
					break;
				case ScrollButton.Up:
					lgbr = new LinearGradientBrush( new Point( area.X, area.Y ), new Point( area.X, area.Bottom - 1 ), use_color, Color.White );
					lgbr.Blend = FlatBlend;
					dc.FillRectangle( lgbr, area.X + 1, area.Y + 1, area.Width - 2, area.Height - 2 );
					
					points = new Point[] {
						new Point( area.X + 2, area.Y ),
						new Point( area.Right - 3, area.Y ),
						new Point( area.Right - 1, area.Y + 2 ),
						new Point( area.Right - 1, area.Bottom - 1 ),
						new Point( area.X, area.Bottom - 1 ),
						new Point( area.X, area.Y + 2 ),
						new Point( area.X + 2, area.Y )
					};
					dc.DrawPolygon( pen, points );
					break;
				case ScrollButton.Down:
					lgbr = new LinearGradientBrush( new Point( area.X, area.Y ), new Point( area.X, area.Bottom - 1 ), Color.White, use_color );
					lgbr.Blend = NormalBlend;
					dc.FillRectangle( lgbr, area.X + 1, area.Y + 1, area.Width - 2, area.Height - 2 );
					
					points = new Point[] {
						new Point( area.X, area.Y ),
						new Point( area.Right - 1, area.Y ),
						new Point( area.Right - 1, area.Bottom - 3 ),
						new Point( area.Right - 3, area.Bottom - 1 ),
						new Point( area.X + 2, area.Bottom - 1 ),
						new Point( area.X, area.Bottom - 3 ),
						new Point( area.X, area.Y )
					};
					dc.DrawPolygon( pen, points );
					break;
			}
			
			lgbr.Dispose( );
		}
Example #42
0
        protected override void DrawScrollButton(Graphics dc, Rectangle bounds, Rectangle clippingArea, ScrollButton button, PushButtonState state)
        {
            if (!ThemeVisualStyles.RenderClientAreas)
            {
                base.DrawScrollButton(dc, bounds, clippingArea, button, state);
                return;
            }
            VisualStyleElement element;

            if (button == ScrollButton.Left)
            {
                switch (state)
                {
                case PushButtonState.Hot:
                    element = VisualStyleElement.Spin.DownHorizontal.Hot;
                    break;

                case PushButtonState.Pressed:
                    element = VisualStyleElement.Spin.DownHorizontal.Pressed;
                    break;

                default:
                    element = VisualStyleElement.Spin.DownHorizontal.Normal;
                    break;
                }
            }
            else
            {
                switch (state)
                {
                case PushButtonState.Hot:
                    element = VisualStyleElement.Spin.UpHorizontal.Hot;
                    break;

                case PushButtonState.Pressed:
                    element = VisualStyleElement.Spin.UpHorizontal.Pressed;
                    break;

                default:
                    element = VisualStyleElement.Spin.UpHorizontal.Normal;
                    break;
                }
            }
            if (!VisualStyleRenderer.IsElementDefined(element))
            {
                if (button == ScrollButton.Left)
                {
                    switch (state)
                    {
                    case PushButtonState.Hot:
                        element = VisualStyleElement.ScrollBar.ArrowButton.LeftHot;
                        break;

                    case PushButtonState.Pressed:
                        element = VisualStyleElement.ScrollBar.ArrowButton.LeftPressed;
                        break;

                    default:
                        element = VisualStyleElement.ScrollBar.ArrowButton.LeftNormal;
                        break;
                    }
                }
                else
                {
                    switch (state)
                    {
                    case PushButtonState.Hot:
                        element = VisualStyleElement.ScrollBar.ArrowButton.RightHot;
                        break;

                    case PushButtonState.Pressed:
                        element = VisualStyleElement.ScrollBar.ArrowButton.RightPressed;
                        break;

                    default:
                        element = VisualStyleElement.ScrollBar.ArrowButton.RightNormal;
                        break;
                    }
                }
                if (!VisualStyleRenderer.IsElementDefined(element))
                {
                    base.DrawScrollButton(dc, bounds, clippingArea, button, state);
                    return;
                }
            }
            new VisualStyleRenderer(element).DrawBackground(dc, bounds, clippingArea);
        }
Example #43
0
		/// <summary>
		/// Initializes a new instance of the <see cref="NuGenScrollBar"/> class.
		/// </summary>
		/// <param name="serviceProvider">
		/// Requires:<para/>
		/// <see cref="INuGenButtonStateService"/><para/>
		/// <see cref="INuGenControlStateService"/><para/>
		/// <see cref="INuGenValueTrackerService"/><para/>
		/// <see cref="INuGenScrollBarRenderer"/><para/>
		/// </param>
		/// <exception cref="ArgumentNullException">
		/// <para><paramref name="serviceProvider"/> is <see langword="null"/>.</para>
		/// </exception>
		public NuGenScrollBar(INuGenServiceProvider serviceProvider)
			: base(serviceProvider)
		{
			_components = new Container();

			_smallChangeDownTimer = new Timer(_components);
			_smallChangeUpTimer = new Timer(_components);
			_largeChangeDownTimer = new Timer(_components);
			_largeChangeUpTimer = new Timer(_components);

			_leftTopButton = new ScrollButton(serviceProvider);
			_rightBottomButton = new ScrollButton(serviceProvider);
			_leftTopTrack = new ScrollTrack(serviceProvider);
			_rightBottomTrack = new ScrollTrack(serviceProvider);
			_sizeBox = new SizeBox(serviceProvider);

			this.InitializeSizeBox(_sizeBox);
			this.InitializeLeftTopButton(_leftTopButton);
			this.InitializeRightBottomButton(_rightBottomButton);
			this.InitializeLeftTopTrack(_leftTopTrack);
			this.InitializeRightBottomTrack(_rightBottomTrack);

			this.InitializeLargeChangeDownTimer(_largeChangeDownTimer);
			this.InitializeLargeChangeUpTimer(_largeChangeUpTimer);
			this.InitializeSmallChangeDownTimer(_smallChangeDownTimer);
			this.InitializeSmallChangeUpTimer(_smallChangeUpTimer);

			this.Controls.AddRange(
				new Control[] {
					_sizeBox
					, _leftTopTrack
					, _rightBottomTrack
					, _leftTopButton
					, _rightBottomButton
				}
			);

			this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
			this.BackColor = Color.Transparent;

			this.ValueTracker.LargeChange = this.DefaultLargeChange;
			this.ValueTracker.Maximum = this.DefaultMaximum;
			this.ValueTracker.Minimum = this.DefaultMinimum;
			this.ValueTracker.SmallChange = this.DefaultSmallChange;
			this.ValueTracker.Value = this.DefaultValue;

			this.BuildLayout();
		}
Example #44
0
File: Theme.cs Project: yonder/mono
 public abstract void CPDrawScrollButton(Graphics graphics, Rectangle rectangle, ScrollButton button, ButtonState state);
Example #45
0
		/*
		 * InitializeLeftTopButton
		 */

		private void InitializeLeftTopButton(ScrollButton leftTopButton)
		{
			Debug.Assert(leftTopButton != null, "leftTopButton != null");

			leftTopButton.MouseDown += _leftTopButton_MouseDown;
			leftTopButton.MouseUp += _leftTopButton_MouseUp;
		}
 public static void DrawScrollButton(Graphics graphics, int x, int y, int width, int height, ScrollButton button, ButtonState state)
 {
     DrawFrameControl(graphics, x, y, width, height, 3, (int) (button | ((ScrollButton) ((int) state))), Color.Empty, Color.Empty);
 }
Example #47
0
		/*
		 * InitializeRightBottomButton
		 */

		private void InitializeRightBottomButton(ScrollButton rightBottomButton)
		{
			Debug.Assert(rightBottomButton != null, "rightBottomButton != null");

			rightBottomButton.MouseDown += _rightBottomButton_MouseDown;
			rightBottomButton.MouseUp += _rightBottomButton_MouseUp;
		}