示例#1
0
        private void dateTimeInput11_MonthCalendar_PaintLabel(object sender, DevComponents.Editors.DateTimeAdv.DayPaintEventArgs e)
        {
            DevComponents.Editors.DateTimeAdv.DayLabel day = sender as DevComponents.Editors.DateTimeAdv.DayLabel;
            if (day == null || day.Date == DateTime.MinValue)
            {
                return;
            }

            // Cross all weekend days and disable selection for them...
            if ((day.Date.DayOfWeek == DayOfWeek.Saturday || day.Date.DayOfWeek == DayOfWeek.Sunday) && day.Date != DateTime.Today.AddDays(1))
            {
                day.Selectable = false; // Mark label as not selectable...
                day.TrackMouse = false; // Do not track mouse movement...
                e.PaintBackground();
                e.PaintText();
                Rectangle r = day.Bounds;
                r.Inflate(-2, -2);
                SmoothingMode sm = e.Graphics.SmoothingMode;
                e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
                e.Graphics.DrawLine(Pens.Red, r.X, r.Y, r.Right, r.Bottom);
                e.Graphics.DrawLine(Pens.Red, r.Right, r.Y, r.X, r.Bottom);
                e.Graphics.SmoothingMode = sm;
                // Ensure that no part is rendered internally by control...
                e.RenderParts = DevComponents.Editors.DateTimeAdv.eDayPaintParts.None;
            }
            // Mark tomorrows day...
            else if (day != null && day.Date == DateTime.Today.AddDays(1))
            {
                e.PaintBackground();
                e.PaintText();
                SmoothingMode sm = e.Graphics.SmoothingMode;
                e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
                Rectangle r = day.Bounds;
                r.Width--;
                r.Height--;
                using (Pen pen = new Pen(Color.FromArgb(128, Color.Blue)))
                    e.Graphics.DrawEllipse(pen, r);
                e.Graphics.SmoothingMode = sm;
                // Ensure that no part is rendered internally by control...
                e.RenderParts = DevComponents.Editors.DateTimeAdv.eDayPaintParts.None;
            }
        }