DevExpress DateEdit 5 常见问题解决方法
1. 如何设置选择的日期大于当天?
- dateEdit1.Properties.MinValue = DateTime.Now.AddDays(1)
2. 如何做到只显示年、月?
- var formatString = "yyyy.MM";
- var dateEdit=new DateEdit();
- dateEdit.Properties.Mask.EditMask = formatString;
- dateEdit.Properties.VistaCalendarInitialViewStyle =
3. 如何选择精确到秒?
- dateEdit1.Properties.DisplayFormat.FormatString="G")
- dateEdit1.Properties.DisplayFormat.FormatType=DateTime
4. 如何解决显示周名时,只能显示一个“星”字的问题?
- public class MyDateEdit : DevExpress.XtraEditors.DateEdit
- {
- protected override DevExpress.XtraEditors.Popup.PopupBaseForm CreatePopupForm()
- {
- return new MyPopupDateEditForm(this);
- }
- }
- public class MyPopupDateEditForm : DevExpress.XtraEditors.Popup.PopupDateEditForm
- {
- public MyPopupDateEditForm(MyDateEdit dateEdit) : base(dateEdit)
- {
- }
- protected override DevExpress.XtraEditors.Controls.DateEditCalendar CreateCalendar()
- {