本文整理汇总了C#中System.Windows.Forms.MonthCalendar.IsBoldedDate方法的典型用法代码示例。如果您正苦于以下问题:C# MonthCalendar.IsBoldedDate方法的具体用法?C# MonthCalendar.IsBoldedDate怎么用?C# MonthCalendar.IsBoldedDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.MonthCalendar
的用法示例。
在下文中一共展示了MonthCalendar.IsBoldedDate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawMonthCalendarDate
// draws one day in the calendar grid
private void DrawMonthCalendarDate (Graphics dc, Rectangle rectangle, MonthCalendar mc, DateTime date, DateTime month, int row, int col) {
Color date_color = mc.ForeColor;
Rectangle interior = new Rectangle (rectangle.X, rectangle.Y, Math.Max(rectangle.Width - 1, 0), Math.Max(rectangle.Height - 1, 0));
// find out if we are the lead of the first calendar or the trail of the last calendar
if (date.Year != month.Year || date.Month != month.Month) {
DateTime check_date = month.AddMonths (-1);
// check if it's the month before
if (check_date.Year == date.Year && check_date.Month == date.Month && row == 0 && col == 0) {
date_color = mc.TrailingForeColor;
} else {
// check if it's the month after
check_date = month.AddMonths (1);
if (check_date.Year == date.Year && check_date.Month == date.Month && row == mc.CalendarDimensions.Height-1 && col == mc.CalendarDimensions.Width-1) {
date_color = mc.TrailingForeColor;
} else {
return;
}
}
} else {
date_color = mc.ForeColor;
}
const int inflate = -1;
if (date == mc.SelectionStart.Date && date == mc.SelectionEnd.Date) {
// see if the date is in the start of selection
date_color = mc.BackColor;
// draw the left hand of the back ground
Rectangle selection_rect = Rectangle.Inflate (rectangle, inflate, inflate);
dc.FillPie (ResPool.GetSolidBrush (mc.TitleBackColor), selection_rect, 0, 360);
} else if (date == mc.SelectionStart.Date) {
// see if the date is in the start of selection
date_color = mc.BackColor;
// draw the left hand of the back ground
Rectangle selection_rect = Rectangle.Inflate (rectangle, inflate, inflate);
dc.FillPie (ResPool.GetSolidBrush (mc.TitleBackColor), selection_rect, 90, 180);
// fill the other side as a straight rect
if (date < mc.SelectionEnd.Date)
{
// use rectangle instead of rectangle to go all the way to edge of rect
selection_rect.X = (int) Math.Floor((double)(rectangle.X + rectangle.Width / 2));
selection_rect.Width = Math.Max(rectangle.Right - selection_rect.X, 0);
dc.FillRectangle (ResPool.GetSolidBrush (mc.TitleBackColor), selection_rect);
}
} else if (date == mc.SelectionEnd.Date) {
// see if it is the end of selection
date_color = mc.BackColor;
// draw the left hand of the back ground
Rectangle selection_rect = Rectangle.Inflate (rectangle, inflate, inflate);
dc.FillPie (ResPool.GetSolidBrush (mc.TitleBackColor), selection_rect, 270, 180);
// fill the other side as a straight rect
if (date > mc.SelectionStart.Date) {
selection_rect.X = rectangle.X;
selection_rect.Width = rectangle.Width - (rectangle.Width / 2);
dc.FillRectangle (ResPool.GetSolidBrush (mc.TitleBackColor), selection_rect);
}
} else if (date > mc.SelectionStart.Date && date < mc.SelectionEnd.Date) {
// now see if it's in the middle
date_color = mc.BackColor;
// draw the left hand of the back ground
Rectangle selection_rect = Rectangle.Inflate (rectangle, 0, inflate);
dc.FillRectangle (ResPool.GetSolidBrush (mc.TitleBackColor), selection_rect);
}
// establish if it's a bolded font
Font font = mc.IsBoldedDate (date) ? mc.bold_font : mc.Font;
// just draw the date now
dc.DrawString (date.Day.ToString(), font, ResPool.GetSolidBrush (date_color), rectangle, mc.centered_format);
// today circle if needed
if (mc.ShowTodayCircle && date == DateTime.Now.Date) {
DrawTodayCircle (dc, interior);
}
// draw the selection grid
if (mc.is_date_clicked && mc.clicked_date == date) {
Pen pen = ResPool.GetDashPen (Color.Black, DashStyle.Dot);
dc.DrawRectangle (pen, interior);
}
}