What it does is takes a date editor and stops it from going to the day view, but selects the month. It is using Developer Express, but I really just don't understand the syntax of C#.Code:public class MyVistaDateEditCalendar : VistaDateEditCalendar { public MyVistaDateEditCalendar(RepositoryItemDateEdit item, object editDate) : base(item, editDate) { } protected override void Init() { base.Init(); this.View = DateEditCalendarViewType.YearInfo; } public override void OnItemClick(DevExpress.XtraEditors.Calendar.CalendarHitInfo hitInfo) { DayNumberCellInfo cell = hitInfo.HitObject as DayNumberCellInfo; if (View == DateEditCalendarViewType.YearInfo) { DateTime dt = new DateTime(DateTime.Year, cell.Date.Month, CorrectDay(DateTime.Year, cell.Date.Month, DateTime.Day), DateTime.Hour, DateTime.Minute, DateTime.Second); OnDateTimeCommit(dt, false); } else base.OnItemClick(hitInfo); } } public class MyVistaPopupDateEditForm : VistaPopupDateEditForm { public MyVistaPopupDateEditForm(DateEdit ownerEdit) : base(ownerEdit) { } protected override DateEditCalendar CreateCalendar() { return new MyVistaDateEditCalendar(OwnerEdit.Properties, OwnerEdit.EditValue); } } public class MyDateEdit : DateEdit { protected override PopupBaseForm CreatePopupForm() { if (Properties.VistaDisplayMode == DevExpress.Utils.DefaultBoolean.True) return new MyVistaPopupDateEditForm(this); return new PopupDateEditForm(this); } }




Reply With Quote