有一段代码如下:
一、
Public Class CalendarColumn
Inherits DataGridViewColumn
Private m_eFormatType As DateTimePickerFormat = DateTimePickerFormat.Short
Private m_strCustomFormat As String = ""
Private m_bShowUpDown As Boolean = True
Private m_bShorCheckBox As Boolean = True
Public Sub New()
MyBase.New(New CalendarCell())
End Sub
Public Overrides Property CellTemplate() As DataGridViewCell
Get
Select Case m_eFormatType
Case DateTimePickerFormat.Short
MyBase.DefaultCellStyle.Format = "d"
Case DateTimePickerFormat.Long
MyBase.DefaultCellStyle.Format = "D"
Case DateTimePickerFormat.Time
MyBase.DefaultCellStyle.Format = "T"
Case DateTimePickerFormat.Custom
MyBase.DefaultCellStyle.Format = CustomFormat
一、
Public Class CalendarColumn
Inherits DataGridViewColumn
Private m_eFormatType As DateTimePickerFormat = DateTimePickerFormat.Short
Private m_strCustomFormat As String = ""
Private m_bShowUpDown As Boolean = True
Private m_bShorCheckBox As Boolean = True
Public Sub New()
MyBase.New(New CalendarCell())
End Sub
Public Overrides Property CellTemplate() As DataGridViewCell
Get
Select Case m_eFormatType
Case DateTimePickerFormat.Short
MyBase.DefaultCellStyle.Format = "d"
Case DateTimePickerFormat.Long
MyBase.DefaultCellStyle.Format = "D"
Case DateTimePickerFormat.Time
MyBase.DefaultCellStyle.Format = "T"
Case DateTimePickerFormat.Custom
MyBase.DefaultCellStyle.Format = CustomFormat