Example #1
0
        /*
         * DrawSpinArrow
         */

        /// <summary>
        /// </summary>
        /// <param name="g"></param>
        /// <param name="state"></param>
        /// <param name="style"></param>
        /// <exception cref="ArgumentNullException">
        /// <para><paramref name="g"/> is <see langword="null"/>.</para>
        /// </exception>
        private void DrawSpinArrow(Graphics g, NuGenControlState state, NuGenSpinButtonStyle style)
        {
            if (g == null)
            {
                throw new ArgumentNullException("g");
            }

            using (Pen pen = this.GetBorderPen(state))
            {
                Point p1 = Point.Empty;
                Point p2 = Point.Empty;
                Point p3 = Point.Empty;

                switch (style)
                {
                case NuGenSpinButtonStyle.Down:
                {
                    p1 = new Point(4, 3);
                    p2 = new Point(8, 7);
                    p3 = new Point(12, 3);

                    for (int i = 0; i < 3; i++)
                    {
                        p1.X++;
                        p2.Y--;
                        p3.X--;

                        g.DrawLine(pen, p1, p2);
                        g.DrawLine(pen, p2, p3);
                    }

                    break;
                }

                default:
                {
                    p1 = new Point(4, 6);
                    p2 = new Point(8, 2);
                    p3 = new Point(12, 6);

                    for (int i = 0; i < 3; i++)
                    {
                        p1.X++;
                        p2.Y++;
                        p3.X--;

                        g.DrawLine(pen, p1, p2);
                        g.DrawLine(pen, p2, p3);
                    }

                    break;
                }
                }
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="NuGenSpinButtonPaintParams"/> class.
 /// </summary>
 /// <exception cref="ArgumentNullException">
 /// <para>
 ///		<paramref name="sender"/> is <see langword="null"/>.
 /// </para>
 /// -or-
 /// <para>
 ///		<paramref name="g"/> is <see langword="null"/>.
 /// </para>
 /// </exception>
 public NuGenSpinButtonPaintParams(
     object sender,
     Graphics g,
     Rectangle bounds,
     NuGenControlState state,
     NuGenSpinButtonStyle style
     )
     : base(sender, g, bounds, state)
 {
     _style = style;
 }
		/// <summary>
		/// Initializes a new instance of the <see cref="NuGenSpinButtonPaintParams"/> class.
		/// </summary>
		/// <exception cref="ArgumentNullException">
		/// <para>
		///		<paramref name="sender"/> is <see langword="null"/>.
		/// </para>
		/// -or-
		/// <para>
		///		<paramref name="g"/> is <see langword="null"/>.
		/// </para>
		/// </exception>
		public NuGenSpinButtonPaintParams(
			object sender,
			Graphics g,
			Rectangle bounds,
			NuGenControlState state,
			NuGenSpinButtonStyle style
			)
			: base(sender, g, bounds, state)
		{
			_style = style;
		}
Example #4
0
        /*
         * DrawSpinButton
         */

        /// <summary>
        /// </summary>
        /// <param name="paintParams"></param>
        /// <exception cref="ArgumentNullException">
        /// <para><paramref name="paintParams"/> is <see langword="null"/>.</para>
        /// </exception>
        public void DrawSpinButton(NuGenSpinButtonPaintParams paintParams)
        {
            if (paintParams == null)
            {
                throw new ArgumentNullException("paintParams");
            }

            Graphics             g      = paintParams.Graphics;
            Rectangle            bounds = paintParams.Bounds;
            NuGenControlState    state  = paintParams.State;
            NuGenSpinButtonStyle style  = paintParams.Style;

            this.DrawBackground(paintParams);
            this.DrawBorder(g, NuGenControlPaint.BorderRectangle(bounds), state);
            this.DrawSpinArrow(g, state, style);
        }
		/*
		 * DrawSpinArrow
		 */

		/// <summary>
		/// </summary>
		/// <param name="g"></param>
		/// <param name="state"></param>
		/// <param name="style"></param>
		/// <exception cref="ArgumentNullException">
		/// <para><paramref name="g"/> is <see langword="null"/>.</para>
		/// </exception>
		private void DrawSpinArrow(Graphics g, NuGenControlState state, NuGenSpinButtonStyle style)
		{
			if (g == null)
			{
				throw new ArgumentNullException("g");
			}

			using (Pen pen = this.GetBorderPen(state))
			{
				Point p1 = Point.Empty;
				Point p2 = Point.Empty;
				Point p3 = Point.Empty;

				switch (style)
				{
					case NuGenSpinButtonStyle.Down:
					{
						p1 = new Point(4, 3);
						p2 = new Point(8, 7);
						p3 = new Point(12, 3);

						for (int i = 0; i < 3; i++)
						{
							p1.X++;
							p2.Y--;
							p3.X--;

							g.DrawLine(pen, p1, p2);
							g.DrawLine(pen, p2, p3);
						}

						break;
					}
					default:
					{
						p1 = new Point(4, 6);
						p2 = new Point(8, 2);
						p3 = new Point(12, 6);

						for (int i = 0; i < 3; i++)
						{
							p1.X++;
							p2.Y++;
							p3.X--;

							g.DrawLine(pen, p1, p2);
							g.DrawLine(pen, p2, p3);
						}

						break;
					}
				}
			}
		}