GrapeCity.Win.MultiRow Namespace : NumericUpDownCell Class |
<ToolboxItemFilterAttribute(FilterString="GrapeCity.Win.MultiRow.Template7", FilterType=ToolboxItemFilterType.Custom Or _ ToolboxItemFilterType.Prevent Or _ ToolboxItemFilterType.Require)> <FeatureAttribute(Name="NumericUpDownCell", Version="v5.0")> <ToolboxBitmapAttribute()> <SRDescriptionAttribute("Enables the user to input a number.")> <DesignerAttribute(DesignerBaseTypeName="System.ComponentModel.Design.IDesigner", DesignerTypeName="GrapeCity.Win.MultiRow.Design.DataFieldAndValidatorCellDesigner,GrapeCity.Win.MultiRow.Design, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")> Public Class NumericUpDownCell Inherits Cell
Dim instance As NumericUpDownCell
[ToolboxItemFilter(FilterString="GrapeCity.Win.MultiRow.Template7", FilterType=ToolboxItemFilterType.Custom | ToolboxItemFilterType.Prevent | ToolboxItemFilterType.Require)] [Feature(Name="NumericUpDownCell", Version="v5.0")] [ToolboxBitmap()] [SRDescription("Enables the user to input a number.")] [Designer(DesignerBaseTypeName="System.ComponentModel.Design.IDesigner", DesignerTypeName="GrapeCity.Win.MultiRow.Design.DataFieldAndValidatorCellDesigner,GrapeCity.Win.MultiRow.Design, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")] public class NumericUpDownCell : Cell
A NumericUpDownCell contains a single numeric value that can be incremented or decremented by clicking the up or down buttons of the control. The user can also enter a value, unless the Cell.ReadOnly property is set to true.
The numeric display can be formatted by setting the DecimalPlaces, Hexadecimal, or ThousandsSeparator properties. To display hexadecimal values in the control, set the Hexadecimal property to true. To display a thousands separator in decimal numbers when appropriate, set the ThousandsSeparator property to true. To specify the number of digits displayed after the decimal symbol, set the DecimalPlaces property to the number of decimal places to display.
To specify the allowable range of values for the control, set the Minimum and Maximum properties. Set the Increment value to specify the value to be incremented or decremented in the Value property when the user clicks the up or down arrow buttons. You can increase the speed that the control moves through numbers when the user continuously presses the up or down arrow by setting the Accelerations property.
using System; using System.Windows.Forms; using System.Drawing; namespace GrapeCity.Win.MultiRow.SampleCode { public class NumericUpDownCellDemo : Form { private GcMultiRow gcMultiRow1 = new GcMultiRow(); public NumericUpDownCellDemo() { this.Text = "NumericUpDownCell Demo"; this.gcMultiRow1.Dock = DockStyle.Fill; this.Controls.Add(this.gcMultiRow1); this.Load += new EventHandler(Form1_Load); this.Size = new Size(400, 400); } private void Form1_Load(object sender, EventArgs e) { NumericUpDownCell numericUpDownCell1 = new NumericUpDownCell(); //The minimum value is 0, maximum value is 10, initial value is 0; numericUpDownCell1.Minimum = 0; numericUpDownCell1.Maximum = 10; numericUpDownCell1.Value = 0; //Use the Left, Right, Up, and Down keys. numericUpDownCell1.InterceptArrowKeys = true; //Select a cell, the SpinButton displays. numericUpDownCell1.ShowSpinButton = CellButtonVisibility.ShowForCurrentCell; numericUpDownCell1.DecimalPlaces = 2; //Press the arrow key, the value increases by 0.01 numericUpDownCell1.Increment = 0.01m; //Enter edit mode, the text is selected. numericUpDownCell1.HighlightText = true; NumericUpDownCell numericUpDownCell2 = new NumericUpDownCell(); numericUpDownCell2.Value = 16m; //The value displays as hexadecimal. numericUpDownCell2.Hexadecimal = true; //The initial value is 15, it displays 'F' numericUpDownCell2.Value = 15; //The UpDown button aligns to left. numericUpDownCell2.UpDownAlign = LeftRightAlignment.Left; //The thousand separator ',' is inserted. numericUpDownCell2.ThousandsSeparator = true; //Press the Up or Down key, after 2 seconds, the value increases by 50, after 6 seconds, by 300. numericUpDownCell2.Accelerations.AddRange(new NumericUpDownAcceleration[] { new NumericUpDownAcceleration(2, 50), new NumericUpDownAcceleration(6, 300) }); //If the value cannot be displayed completely, an ellipsis string is shown in the middle. numericUpDownCell2.Ellipsis = MultiRowEllipsisMode.EllipsisPath; numericUpDownCell2.EllipsisString = "..."; Template template1 = Template.CreateGridTemplate(new Cell[] { numericUpDownCell1, numericUpDownCell2 }, Int32.MaxValue, AutoGenerateGridTemplateStyles.ColumnHeader | AutoGenerateGridTemplateStyles.RowHeaderAutoNumber); template1.ColumnHeaders[0].Cells[0].Value = "Column1"; template1.ColumnHeaders[0].Cells[1].Value = "Column2"; gcMultiRow1.Template = template1; gcMultiRow1.RowCount = 10; }
Imports System Imports System.Windows.Forms Imports System.Drawing Imports GrapeCity.Win.MultiRow Public Class NumericUpDownCellDemo Inherits Form Private gcMultiRow1 As New GcMultiRow() Public Sub New() Me.Text = "NumericUpDownCell Demo" Me.gcMultiRow1.Dock = DockStyle.Fill Me.Controls.Add(Me.gcMultiRow1) Me.Size = New Size(400, 400) End Sub #Region "ID_001" Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load Dim numericUpDownCell1 As New NumericUpDownCell() 'The minimum value is 0, maximum value is 10, initial value is 0; numericUpDownCell1.Minimum = 0 numericUpDownCell1.Maximum = 10 numericUpDownCell1.Value = 0 'Use the Left, Right, Up, and Down keys. numericUpDownCell1.InterceptArrowKeys = True 'Select a cell, the SpinButton displays. numericUpDownCell1.ShowSpinButton = CellButtonVisibility.ShowForCurrentCell numericUpDownCell1.DecimalPlaces = 2 'Press the arrow key, the value increases by 0.01 numericUpDownCell1.Increment = 0.01D 'Enter edit mode, the text is selected. numericUpDownCell1.HighlightText = True Dim numericUpDownCell2 As New NumericUpDownCell() numericUpDownCell2.Value = 16D 'The value displays as hexadecimal. numericUpDownCell2.Hexadecimal = True 'The initial value is 15, it displays 'F' numericUpDownCell2.Value = 15 'The UpDown button aligns to left. numericUpDownCell2.UpDownAlign = LeftRightAlignment.Left 'The thousand separator ',' is inserted. numericUpDownCell2.ThousandsSeparator = True 'Press the Up or Down key, after 2 seconds, the value increases by 50, after 6 seconds, by 300. numericUpDownCell2.Accelerations.AddRange(New NumericUpDownAcceleration() {New NumericUpDownAcceleration(2, 50), New NumericUpDownAcceleration(6, 300)}) 'If the value cannot be displayed completely, an ellipsis string is shown in the middle. numericUpDownCell2.Ellipsis = MultiRowEllipsisMode.EllipsisPath numericUpDownCell2.EllipsisString = "..." Dim template1 As Template = Template.CreateGridTemplate(New Cell() {numericUpDownCell1, numericUpDownCell2}) template1.ColumnHeaders(0).Cells(0).Value = "Column1" template1.ColumnHeaders(0).Cells(1).Value = "Column2" gcMultiRow1.Template = template1 gcMultiRow1.RowCount = 10 End Sub
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
GrapeCity.Win.MultiRow.Cell
GrapeCity.Win.MultiRow.NumericUpDownCell
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2