| MultiRow Windows Forms > Developer's Guide > Using MultiRow > Cell Types > NumericUpDownCell > Hiding Spin Button (NumericUpDownCell) |
You can hide the spin button in the numeric up down cell by setting the NumericUpDownCell.ShowSpinButton property to NotShown; however, this setting is only enabled when the cell is not in an editable state. In order to hide the spin button in an editable state, you need to adjust the position of the spin button so that it is not visible when the numeric up down cell displays the cell editing control.

The following code creates a user-defined numeric cell that inherits from the NumericUpDownCell class.
Imports System.Drawing
Imports System.Windows.Forms
Imports GrapeCity.Win.MultiRow
' NumericUpDownCell without the spin button.
NumericUpDownCell
Public Class NumericCell
Inherits NumericUpDownCell
Public Sub New()
Me.ShowSpinButton = CellButtonVisibility.NotShown
End Sub
Protected Overrides Function GetEditingControlBounds(ByVal cellBounds As System.Drawing.Rectangle, ByVal rowIndex As Integer) As System.Drawing.Rectangle
Return New Rectangle(cellBounds.Location, New Size(cellBounds.Width + SystemInformation.VerticalScrollBarWidth, cellBounds.Height))
End Function
End Class
|
using System.Drawing;
using System.Windows.Forms;
using GrapeCity.Win.MultiRow;
// NumericUpDownCell without the spin button.
public class NumericCell : NumericUpDownCell
{
public NumericCell()
{
this.ShowSpinButton = CellButtonVisibility.NotShown;
}
protected override Rectangle GetEditingControlBounds(Rectangle cellBounds, int rowIndex)
{
return new Rectangle(cellBounds.Location, new Size(cellBounds.Width + SystemInformation.VerticalScrollBarWidth, cellBounds.Height));
}
}
|
Use the following steps to use the custom NumericCell in the designer.
This example uses the custom cell.
Imports GrapeCity.Win.MultiRow
Dim numericCell1 As New NumericCell()
GcMultiRow1.Template = Template.CreateGridTemplate(New Cell() { numericCell1 })
GcMultiRow1.RowCount = 10
|
using GrapeCity.Win.MultiRow;
NumericCell numericCell1 = new NumericCell();
gcMultiRow1.Template = Template.CreateGridTemplate(new Cell[] { numericCell1 });
gcMultiRow1.RowCount = 10;
|