MultiRow Windows Forms > Developer's Guide > Using MultiRow > Cell Types > DateTimePickerCell > Hide Drop-Down Button (DateTimePickerCell) |
You can hide the drop-down button in the date time picker cell by setting the DateTimePickerCell.ShowDropDownButton property to NotShown and the DateTimePickerCell.ShowUpDown to True. In this case the spin button is shown instead of the drop-down button while editing a cell, so you may wish to adjust the position of the spin button in code in order to hide it.
The following code creates a user-defined cell, DateCell, that inherits the date time picker cell.
Imports GrapeCity.Win.MultiRow Public Class DateCell Inherits DateTimePickerCell Public Sub New() Me.ShowDropDownButton = CellButtonVisibility.NotShown Me.ShowUpDown = True End Sub Protected Overrides Function GetEditingControlBounds(ByVal cellBounds As Rectangle, ByVal rowIndex As Integer) As 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; public class DateCell : DateTimePickerCell { public DateCell() { this.ShowDropDownButton = CellButtonVisibility.NotShown; this.ShowUpDown = true; } 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 date cell in the designer.
This example creates a date cell.
Imports GrapeCity.Win.MultiRow Dim dateCell1 As New DateCell() GcMultiRow1.Template = Template.CreateGridTemplate(New Cell() { dateCell1 }) GcMultiRow1.RowCount = 10 |
using GrapeCity.Win.MultiRow; DateCell dateCell1 = new DateCell(); gcMultiRow1.Template = Template.CreateGridTemplate(new Cell[] { dateCell1 }); gcMultiRow1.RowCount = 10; |