GrapeCity MultiRow Windows Forms Documentation
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.

Using Code

The following code creates a user-defined cell, DateCell, that inherits the date time picker cell.

[VB]

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

[CS]

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));
    }
}

Using the Designer

Use the following steps to use the date cell in the designer.

  1. Save the above code in a file such as DateCell.vb or DateCell.cs.
  2. Add the file to the project.
  3. Build the project.
  4. Open the template designer.
  5. Select "DateCell" from the toolbox and place it on the designer by dragging it.

Using Code

This example creates a date cell.

[VB]

Imports GrapeCity.Win.MultiRow

Dim dateCell1 As New DateCell()

GcMultiRow1.Template = Template.CreateGridTemplate(New Cell() { dateCell1 })
GcMultiRow1.RowCount = 10

[CS]

using GrapeCity.Win.MultiRow;

DateCell dateCell1 = new DateCell();

gcMultiRow1.Template = Template.CreateGridTemplate(new Cell[] { dateCell1 });
gcMultiRow1.RowCount = 10;
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options