如果要求你必须完成这个需求,可以用下面的代码实现:- private DateTime tempDateTime = DateTime.Now;
- private void c1Calendar1_SelectionChanged(object sender, C1.Win.C1Schedule.SelectionChangedEventArgs e)
- {
- if (MessageBox.Show("确认改变日期吗?","请确认",MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
- {
- tempDateTime = System.Convert.ToDateTime(e.Selection.GetValue(0));
- }
- else
- {
- this.c1Calendar1.SelectionChanged -= new System.EventHandler<C1.Win.C1Schedule.SelectionChangedEventArgs>(this.c1Calendar1_SelectionChanged);
- this.c1Calendar1.SelectedDates = new DateTime[] { tempDateTime };
- this.c1Calendar1.SelectionChanged += new System.EventHandler<C1.Win.C1Schedule.SelectionChangedEventArgs>(this.c1Calendar1_SelectionChanged);
- }
- }
复制代码 |