没有优化,但是已经实现了,写贴上来,以后优化。
using System;
using System.Windows.Forms;
using System.ComponentModel;
namespace ClassLibrary1
{
public class CalendarColumn : DataGridViewColumn
{
//CalendarCell calendarCell = new CalendarCell();
//private string ctrlCustomFormat;
//public string CtrlCustomFormat
//{
// get { return ctrlCustomFormat; }
// set
// {
// ctrlCustomFormat = value;
// calendarCell.CtrlCustomFormat = ctrlCustomFormat;
// }
//}
//private DateTimePickerFormat ctrlFormat;
//public DateTimePickerFormat CtrlFormat
//{
// get { return ctrlFormat; }
// set
// {
// ctrlFormat = value;
// calendarCell.CtrlFormat = ctrlFormat;
// }
//}
//private string ctrlCellForMat;
//public string CtrlCellForMat
//{
// get { return ctrlCellForMat; }
// set
// {
// ctrlCellForMat = value;
// calendarCell.CtrlCellForMat = ctrlCellForMat;
// }
//}
public CalendarColumn()
: base(new CalendarCell())
{
}
public override DataGridViewCell CellTemplate
{
get
{
return base.CellTemplate;
}
set
{
if (value != null && !value.GetType().IsAssignableFrom(typeof(CalendarCell)))
{
throw new InvalidCastExcepti