コード例 #1
0
ファイル: NumberRendererData.cs プロジェクト: zhuangyy/Motion
 /// <summary>
 /// Initializes a new instance of the NumberRendererData class
 /// </summary>
 public NumberRendererData()
 {
     this.upState = UpDownStates.Normal;
     this.downState = UpDownStates.Normal;
     this.clickX = -1;
     this.clickY = -1;
 }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the NumberRendererData class
 /// </summary>
 public NumberRendererData()
 {
     this.upState   = UpDownStates.Normal;
     this.downState = UpDownStates.Normal;
     this.clickX    = -1;
     this.clickY    = -1;
 }
コード例 #3
0
        /// <summary>
        /// Converts the specified UpDownStates value to a ButtonState value
        /// </summary>
        /// <param name="state">The UpDownStates value to be converted</param>
        /// <returns>A ButtonState value that represents the specified UpDownStates
        /// value</returns>
        private static ButtonState ConvertUpDownStateToButtonState(UpDownStates state)
        {
            switch (state)
            {
            case UpDownStates.Pressed:
            {
                return(ButtonState.Pushed);
            }

            case UpDownStates.Disabled:
            {
                return(ButtonState.Inactive);
            }
            }

            return(ButtonState.Normal);
        }
コード例 #4
0
        /// <summary>
        /// Raises the PaintBackground event
        /// </summary>
        /// <param name="e">A PaintCellEventArgs that contains the event data</param>
        protected override void OnPaintBackground(PaintCellEventArgs e)
        {
            base.OnPaintBackground(e);

            // don't bother going any further if the Cell is null
            if (e.Cell == null)
            {
                return;
            }

            if (this.ShowUpDownButtons)
            {
                UpDownStates upButtonState   = this.GetNumberRendererData(e.Cell).UpButtonState;
                UpDownStates downButtonState = this.GetNumberRendererData(e.Cell).DownButtonState;

                if (!e.Enabled)
                {
                    upButtonState   = UpDownStates.Disabled;
                    downButtonState = UpDownStates.Disabled;
                }

                ThemeManager.DrawUpDownButtons(e.Graphics, this.GetUpButtonBounds(), upButtonState, this.GetDownButtonBounds(), downButtonState);
            }
        }
コード例 #5
0
        /// <summary>
        /// Draws an UpDown's up and down buttons in the specified state, on the specified
        /// graphics surface, and within the specified bounds
        /// </summary>
        /// <param name="g">The Graphics to draw on</param>
        /// <param name="upButtonRect">The Rectangle that represents the dimensions
        /// of the up button</param>
        /// <param name="upButtonClipRect">The Rectangle that represents the clipping area
        /// for the up button</param>
        /// <param name="upButtonState">An UpDownStates value that specifies the
        /// state to draw the up button in</param>
        /// <param name="downButtonRect">The Rectangle that represents the dimensions
        /// of the down button</param>
        /// <param name="downButtonClipRect">The Rectangle that represents the clipping area
        /// for the down button</param>
        /// <param name="downButtonState">An UpDownStates value that specifies the
        /// state to draw the down button in</param>
        public static void DrawUpDownButtons(Graphics g, Rectangle upButtonRect, Rectangle upButtonClipRect, UpDownStates upButtonState, Rectangle downButtonRect, Rectangle downButtonClipRect, UpDownStates downButtonState)
        {
            if (g == null)
            {
                return;
            }

            if (upButtonRect.Width > 0 && upButtonRect.Height > 0 && upButtonClipRect.Width > 0 && upButtonClipRect.Height > 0)
            {
                if (ThemeManager.VisualStylesEnabled)
                {
                    ThemeManager.DrawThemeBackground(g, ThemeClasses.UpDown, (int)UpDownParts.Up, (int)upButtonState, upButtonRect, upButtonClipRect);
                }
                else
                {
                    ControlPaint.DrawScrollButton(g, upButtonRect, ScrollButton.Up, ThemeManager.ConvertUpDownStateToButtonState(upButtonState));
                }
            }

            if (downButtonRect.Width > 0 && downButtonRect.Height > 0 && downButtonClipRect.Width > 0 && downButtonClipRect.Height > 0)
            {
                if (ThemeManager.VisualStylesEnabled)
                {
                    ThemeManager.DrawThemeBackground(g, ThemeClasses.UpDown, (int)UpDownParts.Down, (int)downButtonState, downButtonRect, downButtonClipRect);
                }
                else
                {
                    ControlPaint.DrawScrollButton(g, downButtonRect, ScrollButton.Down, ThemeManager.ConvertUpDownStateToButtonState(downButtonState));
                }
            }
        }
コード例 #6
0
 /// <summary>
 /// Draws an UpDown's up and down buttons in the specified state, on the specified
 /// graphics surface, and within the specified bounds
 /// </summary>
 /// <param name="g">The Graphics to draw on</param>
 /// <param name="upButtonRect">The Rectangle that represents the dimensions
 /// of the up button</param>
 /// <param name="upButtonState">An UpDownStates value that specifies the
 /// state to draw the up button in</param>
 /// <param name="downButtonRect">The Rectangle that represents the dimensions
 /// of the down button</param>
 /// <param name="downButtonState">An UpDownStates value that specifies the
 /// state to draw the down button in</param>
 public static void DrawUpDownButtons(Graphics g, Rectangle upButtonRect, UpDownStates upButtonState, Rectangle downButtonRect, UpDownStates downButtonState)
 {
     ThemeManager.DrawUpDownButtons(g, upButtonRect, upButtonRect, upButtonState, downButtonRect, downButtonRect, downButtonState);
 }
コード例 #7
0
		/// <summary>
		/// Converts the specified UpDownStates value to a ButtonState value
		/// </summary>
		/// <param name="state">The UpDownStates value to be converted</param>
		/// <returns>A ButtonState value that represents the specified UpDownStates 
		/// value</returns>
		private static ButtonState ConvertUpDownStateToButtonState(UpDownStates state)
		{
			switch (state)
			{
				case UpDownStates.Pressed:
				{
					return ButtonState.Pushed;
				}

				case UpDownStates.Disabled:
				{
					return ButtonState.Inactive;
				}
			}

			return ButtonState.Normal;
		}
コード例 #8
0
		/// <summary>
		/// Draws an UpDown's up and down buttons in the specified state, on the specified 
		/// graphics surface, and within the specified bounds
		/// </summary>
		/// <param name="g">The Graphics to draw on</param>
		/// <param name="upButtonRect">The Rectangle that represents the dimensions 
		/// of the up button</param>
		/// <param name="upButtonClipRect">The Rectangle that represents the clipping area
		/// for the up button</param>
		/// <param name="upButtonState">An UpDownStates value that specifies the 
		/// state to draw the up button in</param>
		/// <param name="downButtonRect">The Rectangle that represents the dimensions 
		/// of the down button</param>
		/// <param name="downButtonClipRect">The Rectangle that represents the clipping area
		/// for the down button</param>
		/// <param name="downButtonState">An UpDownStates value that specifies the 
		/// state to draw the down button in</param>
		public static void DrawUpDownButtons(Graphics g, Rectangle upButtonRect, Rectangle upButtonClipRect, UpDownStates upButtonState, Rectangle downButtonRect, Rectangle downButtonClipRect, UpDownStates downButtonState)
		{
			if (g == null)
			{
				return;
			}

			if (upButtonRect.Width > 0 && upButtonRect.Height > 0 && upButtonClipRect.Width > 0 && upButtonClipRect.Height > 0)
			{
				if (ThemeManager.VisualStylesEnabled)
				{
					ThemeManager.DrawThemeBackground(g, ThemeClasses.UpDown, (int) UpDownParts.Up, (int) upButtonState, upButtonRect, upButtonClipRect);
				}
				else
				{
					ControlPaint.DrawScrollButton(g, upButtonRect, ScrollButton.Up, ThemeManager.ConvertUpDownStateToButtonState(upButtonState));
				}
			}

			if (downButtonRect.Width > 0 && downButtonRect.Height > 0 && downButtonClipRect.Width > 0 && downButtonClipRect.Height > 0)
			{
				if (ThemeManager.VisualStylesEnabled)
				{
					ThemeManager.DrawThemeBackground(g, ThemeClasses.UpDown, (int) UpDownParts.Down, (int) downButtonState, downButtonRect, downButtonClipRect);
				}
				else
				{
					ControlPaint.DrawScrollButton(g, downButtonRect, ScrollButton.Down, ThemeManager.ConvertUpDownStateToButtonState(downButtonState));
				}
			}
		}
コード例 #9
0
		/// <summary>
		/// Draws an UpDown's up and down buttons in the specified state, on the specified 
		/// graphics surface, and within the specified bounds
		/// </summary>
		/// <param name="g">The Graphics to draw on</param>
		/// <param name="upButtonRect">The Rectangle that represents the dimensions 
		/// of the up button</param>
		/// <param name="upButtonState">An UpDownStates value that specifies the 
		/// state to draw the up button in</param>
		/// <param name="downButtonRect">The Rectangle that represents the dimensions 
		/// of the down button</param>
		/// <param name="downButtonState">An UpDownStates value that specifies the 
		/// state to draw the down button in</param>
		public static void DrawUpDownButtons(Graphics g, Rectangle upButtonRect, UpDownStates upButtonState, Rectangle downButtonRect, UpDownStates downButtonState)
		{
			ThemeManager.DrawUpDownButtons(g, upButtonRect, upButtonRect, upButtonState, downButtonRect, downButtonRect, downButtonState);
		}