一佳一

记录像1+1一样简洁的代码

导航

dateNavigator指定日期设置背景颜色

Posted on 2010-09-17 18:01  一佳一  阅读(2077)  评论(0编辑  收藏  举报

触发CustomDrawDayNumberCell事件

 

代码如下:

private void dateNavigator1_CustomDrawDayNumberCell(object sender, DevExpress.XtraEditors.Calendar.CustomDrawDayNumberCellEventArgs e) {

 if(e.Date.DayOfWeek == DayOfWeek.Friday) {

    e.Graphics.FillRectangle(Brushes.Red, e.Bounds);

    e.Graphics.DrawString(e.Date.Day.ToString(), e.Style.Font, Brushes.White, e.Bounds);

    e.Handled = true;

 }

}

private void dateNavigator1_CustomDrawDayNumberCell(object sender, DevExpress.XtraEditors.Calendar.CustomDrawDayNumberCellEventArgs e) {

 if(e.Date.DayOfWeek == DayOfWeek.Friday) {

    e.Graphics.FillRectangle(Brushes.Red, e.Bounds);

    e.Graphics.DrawString(e.Date.Day.ToString(), e.Style.Font, Brushes.White, e.Bounds);

    e.Handled = true;

 }

}