Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the NumberRendererData class
 /// </summary>
 public I3NumberRendererData()
 {
     this.upState   = I3UpDownStates.Normal;
     this.downState = I3UpDownStates.Normal;
     this.clickX    = -1;
     this.clickY    = -1;
 }
Exemplo n.º 2
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(I3UpDownStates state)
        {
            switch (state)
            {
            case I3UpDownStates.Pressed:
            {
                return(ButtonState.Pushed);
            }

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

            return(ButtonState.Normal);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Raises the PaintBackground event
        /// </summary>
        /// <param name="e">A PaintCellEventArgs that contains the event data</param>
        protected override void OnPaintBackground(I3PaintCellEventArgs e)
        {
            base.OnPaintBackground(e);

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

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

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

                I3ThemeManager.DrawUpDownButtons(e.Graphics, this.GetUpButtonBounds(), upButtonState, this.GetDownButtonBounds(), downButtonState);
            }
        }
Exemplo n.º 4
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, I3UpDownStates upButtonState, Rectangle downButtonRect, Rectangle downButtonClipRect, I3UpDownStates downButtonState)
        {
            if (g == null)
            {
                return;
            }

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

            if (downButtonRect.Width > 0 && downButtonRect.Height > 0 && downButtonClipRect.Width > 0 && downButtonClipRect.Height > 0)
            {
                if (I3ThemeManager.VisualStylesEnabled)
                {
                    I3ThemeManager.DrawThemeBackground(g, I3ThemeClasses.UpDown, (int)I3UpDownParts.Down, (int)downButtonState, downButtonRect, downButtonClipRect);
                }
                else
                {
                    ControlPaint.DrawScrollButton(g, downButtonRect, ScrollButton.Down, I3ThemeManager.ConvertUpDownStateToButtonState(downButtonState));
                }
            }
        }
Exemplo n.º 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="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, I3UpDownStates upButtonState, Rectangle downButtonRect, I3UpDownStates downButtonState)
 {
     I3ThemeManager.DrawUpDownButtons(g, upButtonRect, upButtonRect, upButtonState, downButtonRect, downButtonRect, downButtonState);
 }