Search Results for

    Show / Hide Table of Contents

    Class DataGridViewNumericUpDownCell

    Defines a NumericUpDown cell type for the System.Windows.Forms.DataGridView control

    Inheritance
    object
    DataGridViewElement
    DataGridViewCell
    DataGridViewTextBoxCell
    DataGridViewNumericUpDownCell
    Implements
    ICloneable
    IDisposable
    Inherited Members
    DataGridViewTextBoxCell.CreateAccessibilityInstance()
    DataGridViewTextBoxCell.GetContentBounds(Graphics, DataGridViewCellStyle, int)
    DataGridViewTextBoxCell.OnEnter(int, bool)
    DataGridViewTextBoxCell.OnLeave(int, bool)
    DataGridViewTextBoxCell.OnMouseClick(DataGridViewCellMouseEventArgs)
    DataGridViewTextBoxCell.FormattedValueType
    DataGridViewTextBoxCell.MaxInputLength
    DataGridViewCell.AdjustCellBorderStyle(DataGridViewAdvancedBorderStyle, DataGridViewAdvancedBorderStyle, bool, bool, bool, bool)
    DataGridViewCell.BorderWidths(DataGridViewAdvancedBorderStyle)
    DataGridViewCell.ClickUnsharesRow(DataGridViewCellEventArgs)
    DataGridViewCell.ContentClickUnsharesRow(DataGridViewCellEventArgs)
    DataGridViewCell.ContentDoubleClickUnsharesRow(DataGridViewCellEventArgs)
    DataGridViewCell.Dispose()
    DataGridViewCell.Dispose(bool)
    DataGridViewCell.DoubleClickUnsharesRow(DataGridViewCellEventArgs)
    DataGridViewCell.EnterUnsharesRow(int, bool)
    DataGridViewCell.GetClipboardContent(int, bool, bool, bool, bool, string)
    DataGridViewCell.GetContentBounds(int)
    DataGridViewCell.GetEditedFormattedValue(int, DataGridViewDataErrorContexts)
    DataGridViewCell.GetErrorText(int)
    DataGridViewCell.GetInheritedContextMenuStrip(int)
    DataGridViewCell.GetInheritedState(int)
    DataGridViewCell.GetInheritedStyle(DataGridViewCellStyle, int, bool)
    DataGridViewCell.GetSize(int)
    DataGridViewCell.GetValue(int)
    DataGridViewCell.KeyDownUnsharesRow(KeyEventArgs, int)
    DataGridViewCell.KeyPressUnsharesRow(KeyPressEventArgs, int)
    DataGridViewCell.KeyUpUnsharesRow(KeyEventArgs, int)
    DataGridViewCell.LeaveUnsharesRow(int, bool)
    DataGridViewCell.MeasureTextHeight(Graphics, string, Font, int, TextFormatFlags)
    DataGridViewCell.MeasureTextHeight(Graphics, string, Font, int, TextFormatFlags, out bool)
    DataGridViewCell.MeasureTextPreferredSize(Graphics, string, Font, float, TextFormatFlags)
    DataGridViewCell.MeasureTextSize(Graphics, string, Font, TextFormatFlags)
    DataGridViewCell.MeasureTextWidth(Graphics, string, Font, int, TextFormatFlags)
    DataGridViewCell.MouseClickUnsharesRow(DataGridViewCellMouseEventArgs)
    DataGridViewCell.MouseDoubleClickUnsharesRow(DataGridViewCellMouseEventArgs)
    DataGridViewCell.MouseDownUnsharesRow(DataGridViewCellMouseEventArgs)
    DataGridViewCell.MouseEnterUnsharesRow(int)
    DataGridViewCell.MouseLeaveUnsharesRow(int)
    DataGridViewCell.MouseMoveUnsharesRow(DataGridViewCellMouseEventArgs)
    DataGridViewCell.MouseUpUnsharesRow(DataGridViewCellMouseEventArgs)
    DataGridViewCell.OnClick(DataGridViewCellEventArgs)
    DataGridViewCell.OnContentClick(DataGridViewCellEventArgs)
    DataGridViewCell.OnContentDoubleClick(DataGridViewCellEventArgs)
    DataGridViewCell.OnDoubleClick(DataGridViewCellEventArgs)
    DataGridViewCell.OnKeyDown(KeyEventArgs, int)
    DataGridViewCell.OnKeyPress(KeyPressEventArgs, int)
    DataGridViewCell.OnKeyUp(KeyEventArgs, int)
    DataGridViewCell.OnMouseDoubleClick(DataGridViewCellMouseEventArgs)
    DataGridViewCell.OnMouseDown(DataGridViewCellMouseEventArgs)
    DataGridViewCell.OnMouseEnter(int)
    DataGridViewCell.OnMouseLeave(int)
    DataGridViewCell.OnMouseMove(DataGridViewCellMouseEventArgs)
    DataGridViewCell.OnMouseUp(DataGridViewCellMouseEventArgs)
    DataGridViewCell.OnDataGridViewChanged()
    DataGridViewCell.PaintBorder(Graphics, Rectangle, Rectangle, DataGridViewCellStyle, DataGridViewAdvancedBorderStyle)
    DataGridViewCell.PaintErrorIcon(Graphics, Rectangle, Rectangle, string)
    DataGridViewCell.ParseFormattedValue(object, DataGridViewCellStyle, TypeConverter, TypeConverter)
    DataGridViewCell.PositionEditingPanel(Rectangle, Rectangle, DataGridViewCellStyle, bool, bool, bool, bool)
    DataGridViewCell.SetValue(int, object)
    DataGridViewCell.AccessibilityObject
    DataGridViewCell.ColumnIndex
    DataGridViewCell.ContentBounds
    DataGridViewCell.ContextMenuStrip
    DataGridViewCell.DefaultNewRowValue
    DataGridViewCell.Displayed
    DataGridViewCell.EditedFormattedValue
    DataGridViewCell.ErrorIconBounds
    DataGridViewCell.ErrorText
    DataGridViewCell.FormattedValue
    DataGridViewCell.Frozen
    DataGridViewCell.HasStyle
    DataGridViewCell.InheritedState
    DataGridViewCell.InheritedStyle
    DataGridViewCell.IsInEditMode
    DataGridViewCell.OwningColumn
    DataGridViewCell.OwningRow
    DataGridViewCell.PreferredSize
    DataGridViewCell.ReadOnly
    DataGridViewCell.Resizable
    DataGridViewCell.RowIndex
    DataGridViewCell.Selected
    DataGridViewCell.Size
    DataGridViewCell.Style
    DataGridViewCell.Tag
    DataGridViewCell.ToolTipText
    DataGridViewCell.Value
    DataGridViewCell.Visible
    DataGridViewElement.RaiseCellClick(DataGridViewCellEventArgs)
    DataGridViewElement.RaiseCellContentClick(DataGridViewCellEventArgs)
    DataGridViewElement.RaiseCellContentDoubleClick(DataGridViewCellEventArgs)
    DataGridViewElement.RaiseCellValueChanged(DataGridViewCellEventArgs)
    DataGridViewElement.RaiseDataError(DataGridViewDataErrorEventArgs)
    DataGridViewElement.RaiseMouseWheel(MouseEventArgs)
    DataGridViewElement.State
    DataGridViewElement.DataGridView
    object.GetType()
    object.MemberwiseClone()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: Reportman.Drawing.Forms
    Assembly: Reportman.Drawing.Forms.dll
    Syntax
    public class DataGridViewNumericUpDownCell : DataGridViewTextBoxCell, ICloneable, IDisposable

    Constructors

    DataGridViewNumericUpDownCell()

    Constructor for the DataGridViewNumericUpDownCell cell type

    Declaration
    public DataGridViewNumericUpDownCell()

    Properties

    DecimalPlaces

    The DecimalPlaces property replicates the one from the NumericUpDown control

    Declaration
    public int DecimalPlaces { get; set; }
    Property Value
    Type Description
    int

    EditType

    Define the type of the cell's editing control

    Declaration
    public override Type EditType { get; }
    Property Value
    Type Description
    Type
    Overrides
    DataGridViewCell.EditType

    Increment

    The Increment property replicates the one from the NumericUpDown control

    Declaration
    public decimal Increment { get; set; }
    Property Value
    Type Description
    decimal

    Maximum

    The Maximum property replicates the one from the NumericUpDown control

    Declaration
    public decimal Maximum { get; set; }
    Property Value
    Type Description
    decimal

    Minimum

    The Minimum property replicates the one from the NumericUpDown control

    Declaration
    public decimal Minimum { get; set; }
    Property Value
    Type Description
    decimal

    ThousandsSeparator

    The ThousandsSeparator property replicates the one from the NumericUpDown control

    Declaration
    public bool ThousandsSeparator { get; set; }
    Property Value
    Type Description
    bool

    ValueType

    Returns the type of the cell's Value property

    Declaration
    public override Type ValueType { get; }
    Property Value
    Type Description
    Type
    Overrides
    DataGridViewTextBoxCell.ValueType

    Methods

    Clone()

    Clones a DataGridViewNumericUpDownCell cell, copies all the custom properties.

    Declaration
    public override object Clone()
    Returns
    Type Description
    object
    Overrides
    DataGridViewTextBoxCell.Clone()

    DetachEditingControl()

    DetachEditingControl gets called by the DataGridView control when the editing session is ending

    Declaration
    public override void DetachEditingControl()
    Overrides
    DataGridViewTextBoxCell.DetachEditingControl()

    GetErrorIconBounds(Graphics, DataGridViewCellStyle, int)

    Customized implementation of the GetErrorIconBounds function in order to draw the potential error icon next to the up/down buttons and not on top of them.

    Declaration
    protected override Rectangle GetErrorIconBounds(Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex)
    Parameters
    Type Name Description
    Graphics graphics
    DataGridViewCellStyle cellStyle
    int rowIndex
    Returns
    Type Description
    Rectangle
    Overrides
    DataGridViewTextBoxCell.GetErrorIconBounds(Graphics, DataGridViewCellStyle, int)

    GetFormattedValue(object, int, ref DataGridViewCellStyle, TypeConverter, TypeConverter, DataGridViewDataErrorContexts)

    Customized implementation of the GetFormattedValue function in order to include the decimal and thousand separator characters in the formatted representation of the cell value.

    Declaration
    protected override object GetFormattedValue(object value, int rowIndex, ref DataGridViewCellStyle cellStyle, TypeConverter valueTypeConverter, TypeConverter formattedValueTypeConverter, DataGridViewDataErrorContexts context)
    Parameters
    Type Name Description
    object value
    int rowIndex
    DataGridViewCellStyle cellStyle
    TypeConverter valueTypeConverter
    TypeConverter formattedValueTypeConverter
    DataGridViewDataErrorContexts context
    Returns
    Type Description
    object
    Overrides
    DataGridViewCell.GetFormattedValue(object, int, ref DataGridViewCellStyle, TypeConverter, TypeConverter, DataGridViewDataErrorContexts)

    GetPreferredSize(Graphics, DataGridViewCellStyle, int, Size)

    Custom implementation of the GetPreferredSize function. This implementation uses the preferred size of the base DataGridViewTextBoxCell cell and adds room for the up/down buttons.

    Declaration
    protected override Size GetPreferredSize(Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex, Size constraintSize)
    Parameters
    Type Name Description
    Graphics graphics
    DataGridViewCellStyle cellStyle
    int rowIndex
    Size constraintSize
    Returns
    Type Description
    Size
    Overrides
    DataGridViewTextBoxCell.GetPreferredSize(Graphics, DataGridViewCellStyle, int, Size)

    InitializeEditingControl(int, object, DataGridViewCellStyle)

    Custom implementation of the InitializeEditingControl function. This function is called by the DataGridView control at the beginning of an editing session. It makes sure that the properties of the NumericUpDown editing control are set according to the cell properties.

    Declaration
    public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
    Parameters
    Type Name Description
    int rowIndex
    object initialFormattedValue
    DataGridViewCellStyle dataGridViewCellStyle
    Overrides
    DataGridViewTextBoxCell.InitializeEditingControl(int, object, DataGridViewCellStyle)

    KeyEntersEditMode(KeyEventArgs)

    Custom implementation of the KeyEntersEditMode function. This function is called by the DataGridView control to decide whether a keystroke must start an editing session or not. In this case, a new session is started when a digit or negative sign key is hit.

    Declaration
    public override bool KeyEntersEditMode(KeyEventArgs e)
    Parameters
    Type Name Description
    KeyEventArgs e
    Returns
    Type Description
    bool
    Overrides
    DataGridViewTextBoxCell.KeyEntersEditMode(KeyEventArgs)

    Paint(Graphics, Rectangle, Rectangle, int, DataGridViewElementStates, object, object, string, DataGridViewCellStyle, DataGridViewAdvancedBorderStyle, DataGridViewPaintParts)

    Custom paints the cell. The base implementation of the DataGridViewTextBoxCell type is called first, dropping the icon error and content foreground parts. Those two parts are painted by this custom implementation. In this sample, the non-edited NumericUpDown control is painted by using a call to Control.DrawToBitmap. This is an easy solution for painting controls but it's not necessarily the most performant. An alternative would be to paint the NumericUpDown control piece by piece (text and up/down buttons).

    Declaration
    protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
    Parameters
    Type Name Description
    Graphics graphics
    Rectangle clipBounds
    Rectangle cellBounds
    int rowIndex
    DataGridViewElementStates cellState
    object value
    object formattedValue
    string errorText
    DataGridViewCellStyle cellStyle
    DataGridViewAdvancedBorderStyle advancedBorderStyle
    DataGridViewPaintParts paintParts
    Overrides
    DataGridViewTextBoxCell.Paint(Graphics, Rectangle, Rectangle, int, DataGridViewElementStates, object, object, string, DataGridViewCellStyle, DataGridViewAdvancedBorderStyle, DataGridViewPaintParts)

    PositionEditingControl(bool, bool, Rectangle, Rectangle, DataGridViewCellStyle, bool, bool, bool, bool)

    Custom implementation of the PositionEditingControl method called by the DataGridView control when it needs to relocate and/or resize the editing control.

    Declaration
    public override void PositionEditingControl(bool setLocation, bool setSize, Rectangle cellBounds, Rectangle cellClip, DataGridViewCellStyle cellStyle, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedColumn, bool isFirstDisplayedRow)
    Parameters
    Type Name Description
    bool setLocation
    bool setSize
    Rectangle cellBounds
    Rectangle cellClip
    DataGridViewCellStyle cellStyle
    bool singleVerticalBorderAdded
    bool singleHorizontalBorderAdded
    bool isFirstDisplayedColumn
    bool isFirstDisplayedRow
    Overrides
    DataGridViewTextBoxCell.PositionEditingControl(bool, bool, Rectangle, Rectangle, DataGridViewCellStyle, bool, bool, bool, bool)

    ToString()

    Returns a standard textual representation of the cell.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    DataGridViewTextBoxCell.ToString()

    Implements

    ICloneable
    IDisposable
    In this article
    Back to top Generated by DocFX