public override string ToString() { if (m_date <= DateTime.MinValue) { return("SpecialDay[Not Set]"); } else { return(CalendarObject.FormatDate(null, "SpecialDay[{0:dd/MMM/yyyy}]", m_date)); } }
public override string ToString() { if (m_owner == null) { return(m_date.ToString()); } else if (m_owner.DateTimeFormatInfo == null) { return(m_date.ToString()); } else { return(CalendarObject.FormatDate(m_owner.DateTimeFormatInfo, "{0:" + m_owner.DateTimeFormatInfo.LongDatePattern + "}", m_date)); } }
private void DrawDay(Rectangle rcClip) { if (m_arDays.Count == 0) { CreateDayObject(null, null); } StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Far; sf.LineAlignment = StringAlignment.Near; ArrayList arActiveDay = new ArrayList(); foreach (DayObject dob in m_arDays) { //if (dob.Date.Month == 5 && dob.Date.Day == 31) { // Console.WriteLine(dob.ClientRectangle); //} dob.Show = false; if (m_date.Month == dob.Date.Month) { dob.Show = true; } else { if (dob.Date < m_date && m_bShowDayBeforeThisMonth) { dob.Show = true; } else if (dob.Date > m_date && m_bShowDayAfterThisMonth) { dob.Show = true; } } if (dob.EditorControl != null && m_owner.EditorMode == EditorMode.Alway) { if (dob.Show == false) { int index = base.Style.WeekText.IndexOf(dob.Date.DayOfWeek); Brush br; if (index >= 0) { br = base.Style.WeekText[index].BackBrush; if (br == null) { br = base.Style.DayStyle.NormalDay.BackBrush; } } else { br = base.Style.DayStyle.NormalDay.BackBrush; } if (dob.Selected && dob.Show) { br = base.Style.DayStyle.SelectionDay.BackBrush; } else if (dob.Date.Month != this.Month) { br = base.Style.DayStyle.InactiveDay.BackBrush; } Image imgBack = m_owner.BackgroundImageTemplate; m_g.FillRectangle(br, dob.ClientRectangle); if (imgBack != null) { m_g.DrawImage(imgBack, dob.ClientRectangle); } } m_g.DrawLines(base.Style.GridPen, CalendarObject.PointAroundFromRect(dob.ClientRectangle)); } else if (OnPaintDay != null) { if (dob.Active) { arActiveDay.Add(dob); } if (rcClip.IntersectsWith(dob.ClientRectangle)) { OnPaintDay(m_g, this, dob); } } /*if (OnDrawDay != null) { * if (dob.Active) { * arActiveDay.Add(dob); * } * if (rcClip.IntersectsWith(dob.ClientRectangle)) { * OnDrawDay(m_g, this, dob); * } * }else if (dob.EditorControl != null){ * //Bitmap bmp = dob.GetControlBitmap(); * * //m_g.DrawImage(bmp, dob.ClientRectangle, new Rectangle(new Point(0, 0), bmp.Size), GraphicsUnit.Pixel); * m_g.DrawLines(m_visual.LinePen, CalendarObject.PointAroundFromRect(dob.ClientRectangle)); * } else { * Brush br = m_visual.GetDayOfWeekBackgroundBrush(dob.Date.DayOfWeek); * if (dob.Selected && dob.Show) { * br = m_visual.SelectedBrush; * } else if (dob.Date.Month != m_date.Month) { * br = m_visual.OutOfRangeDayBackgroundBrush; * } * * m_g.FillRectangle(br, dob.ClientRectangle); * m_g.DrawLines(m_visual.LinePen, CalendarObject.PointAroundFromRect(dob.ClientRectangle)); * //m_g.DrawLines(dob.Date.Day == 1 ? m_visual.LinePenActive : m_visual.LinePen, CalendarObject.PointAroundFromRect(dob.ClientRectangle)); * if (dob.Active) { * arActiveDay.Add(dob); * } * * if (dob.Show) { * m_g.DrawString(dob.Date.Day.ToString() * , m_bIsSmall ? m_visual.DayNumberFontSmall : m_visual.DayNumberFont * , dob.Date.Month == m_date.Month ? Brushes.Black : Brushes.Gainsboro * , dob.ClientRectangle, sf); * * if (dob.ShowCheckBox) { * m_g.DrawImage(dob.CheckImage.Bitmap, dob.CheckImage.ClientRectangle.Location); * } * } * * }*/ } // Draw Active Date foreach (DayObject d in arActiveDay) { if (d.Show) { Rectangle rc = d.ClientRectangle; rc.X++; rc.Y++; rc.Width -= 2; rc.Height -= 2; m_g.DrawLines(base.Style.DayStyle.ActiveDay.LinePen, CalendarObject.PointAroundFromRect(rc)); } } }
protected string FormatDate(string format, params object [] args) { return(CalendarObject.FormatDate(m_owner.DateTimeFormatInfo, format, args)); }