public Rectangle DrawGripper(Graphics g, Rectangle rect, CustomAppointment appointment, bool isSelected, int gripWidth, int hourLines, int halfHourHeight) { DrawEventArgs e = new DrawEventArgs(g, rect, appointment, isSelected, gripWidth); if (base.OnResolveDrawGripper(e)) { return rect; } Rectangle rc = CalculateGripRect(rect, appointment, hourLines, halfHourHeight); rc.Width = gripWidth + 1; if (base.m_useGradient) { if (appointment.GradientBackColor == null) { new GradientColor(GradientFill.GetColorLighter(appointment.BorderColor), GradientFill.GetColorDarker(appointment.BorderColor), FillDirection.Vertical).DrawGradient(g, rc); return rc; } appointment.GradientBackColor.DrawGradient(g, rc); return rc; } using (SolidBrush brush = new SolidBrush(appointment.BorderColor)) { g.FillRectangle(brush, rc); } return rc; }
internal virtual bool OnResolveDrawGripper(DrawEventArgs e) { if (this.ResolveDrawGripper != null) { this.ResolveDrawGripper(this, e); return true; } return false; }
public override void DrawAppointment(Graphics g, Rectangle rect, CustomAppointment appointment, bool isSelected, int gripWidth, int hourLines, int halfHourHeight) { DrawEventArgs e = new DrawEventArgs(g, rect, appointment, isSelected, gripWidth); if (!base.OnResolveDrawAppointment(e)) { Pen pen = new Pen(SystemColors.WindowFrame, 1f); if (rect.Width <= base.AppointmentMinimalWidth) { Rectangle rectangle = this.DrawGripper(g, rect, appointment, isSelected, rect.Width, hourLines, halfHourHeight); g.DrawRectangle(pen, rectangle); if (isSelected) { Rectangle rectangle2 = rectangle; rectangle2.Inflate(-2, -2); using (Pen pen2 = new Pen(this.SelectionColor, 2f)) { g.DrawRectangle(pen2, rectangle2); } g.DrawRectangle(pen, rectangle2); } pen.Dispose(); pen = null; } else { StringFormat format = new StringFormat(); format.Alignment = StringAlignment.Near; format.LineAlignment = StringAlignment.Near; Rectangle rectangle3 = rect; rectangle3.X += gripWidth + 2; rectangle3.Width -= gripWidth + 1; using (SolidBrush brush = new SolidBrush(appointment.Color)) { g.FillRectangle(brush, rectangle3); } Rectangle rectangle4 = this.DrawGripper(g, rect, appointment, isSelected, gripWidth, hourLines, halfHourHeight); g.DrawRectangle(pen, rectangle4); Rectangle aTextRect = rectangle3; aTextRect.Inflate(-2, -2); Rectangle layoutRectangle = DrawIcons(g, aTextRect, appointment, base.AppIcons); using (SolidBrush brush2 = new SolidBrush(appointment.TextColor)) { g.DrawString(appointment.Title, this.FontBase, brush2, layoutRectangle, format); } DrawToolTipArrowIfNeeded(g, appointment.Title, this.FontBase, layoutRectangle, rectangle3, halfHourHeight); if (isSelected) { Rectangle rectangle7 = rect; rectangle7.Inflate(-2, -2); using (Pen pen3 = new Pen(appointment.BorderColor, 4f)) { g.DrawRectangle(pen3, rectangle7); } rectangle7.Inflate(2, 2); g.DrawRectangle(pen, rectangle7); rectangle7.Inflate(-4, -4); g.DrawRectangle(pen, rectangle7); } else { using (Pen pen4 = new Pen(SystemColors.InactiveBorder, 1f)) { g.DrawRectangle(pen4, rectangle3); } } pen.Dispose(); pen = null; } } }
internal virtual bool OnResolveDrawAppointment(DrawEventArgs e) { if (this.ResolveDrawAppointment != null) { this.ResolveDrawAppointment(this, e); return true; } return false; }