//public override void DrawAppointment(OpenGlGdiContext gfx, Rectangle rect, Appointment appointment, bool isSelected, int gripWidth, ImageList imageList) public override void DrawAppointment(IGUIContext gfx, RectangleF rect, Appointment appointment, bool isSelected, int gripWidth) { if (rect.Width == 0 || rect.Height == 0) { //if (rect.Width < 6 || rect.Height < 3) return; } //Color start = InterpolateColors(appointment.Color, Color.White, 0.4f); //Color end = InterpolateColors(appointment.Color, Color.White, 0.7f); // better swap start and end color, text is more readable System.Drawing.Color end = InterpolateColors(appointment.Color, System.Drawing.Color.White, 0.4f); System.Drawing.Color start = InterpolateColors(appointment.Color, System.Drawing.Color.White, 0.7f); if ((appointment.Locked) || isSelected) { // Draw back using (var m_Brush = new HatchBrush("LargeConfetti", System.Drawing.Color.FromArgb(70, 90, 125), appointment.Color)) { gfx.FillRectangle(m_Brush, rect); } // little transparent start = System.Drawing.Color.FromArgb(230, start); end = System.Drawing.Color.FromArgb(180, end); using (var aGB = new LinearGradientBrush(start, end, GradientDirections.ForwardDiagonal)) { gfx.FillRectangle(aGB, rect); } } else { // Draw back using (var aGB = new LinearGradientBrush(start, end, GradientDirections.Vertical)) { gfx.FillRectangle(aGB, rect); } } if (isSelected) { RectangleF m_BorderRectangle = rect; m_BorderRectangle.Offset(-1, 0); using (var m_Pen = new Pen(appointment.BorderColor, 4)) { gfx.DrawRectangle(m_Pen, m_BorderRectangle); } } else { // Draw shadow lines float xLeft = rect.X + 6; float xRight = rect.Right + 1; float yTop = rect.Y + 1; float yButton = rect.Bottom + 1; for (int i = 0; i < 5; i++) { using (var shadow_Pen = new Pen(System.Drawing.Color.FromArgb(70 - 12 * i, System.Drawing.Color.Black))) using (var LineBuf = new LineDrawingBuffer(gfx)) { LineBuf.AddLine(shadow_Pen, xLeft + i, yButton + i, xRight + i - 1, yButton + i); LineBuf.AddLine(shadow_Pen, xRight + i, yTop + i, xRight + i, yButton + i); //gfx.DrawLine(shadow_Pen, xLeft + i, yButton + i, xRight + i - 1, yButton + i); //horisontal lines //gfx.DrawLine(shadow_Pen, xRight + i, yTop + i, xRight + i, yButton + i); //vertical } } rect.Width -= 1; using (var m_Pen = new Pen(System.Drawing.Color.FromArgb(70, 90, 125), 1)) { gfx.DrawRectangle(m_Pen, rect); } rect.Width += 1; } // Draw gripper ***** RectangleF m_GripRectangle = rect; m_GripRectangle.Width = gripWidth + 1; using (var aGB = new SolidBrush(appointment.BorderColor)) { gfx.FillRectangle(aGB, m_GripRectangle); } // Draw Icons ***** rect.X += gripWidth + 2; rect.Width -= gripWidth + 2; if (rect.Height > 56) { rect.Y += 6; rect.Height -= 10; } else if (rect.Height > 38) { rect.Y += 4; rect.Height -= 8; } else { rect.Y += 3; rect.Height -= 6; } float LeftX = rect.X; float IconWidth = 0; /** * if (appointment.ImageIndices != null && appointment.ImageIndices.Length > 0 && imageList != null && rect.Width >= 15 && rect.Height >= 10) * { * int imagecount = 0; * * int startX = rect.X; * foreach (int ImageIndex in appointment.ImageIndices) * { * //imageList.Draw(g, new Point(startX, rect.Y), ImageIndex); * imagecount++; * IconWidth += 18; * startX = rect.X + (imagecount * 18); * * if (startX + 18 > rect.Right - (gripWidth)) * { * startX = rect.X; * rect.Y += 18; * rect.Height -= 18; * IconWidth = 0; * * if (rect.Y + 18 > rect.Height) * break; * } * } * * if (IconWidth > 0) * IconWidth += 2; * } **/ rect.Width -= 2; //rect.Y -= 1; // Draw Text ***** System.Drawing.SizeF TextSize = gfx.MeasureString(appointment.Title, this.BaseFont, rect, m_AppointmentStringFormat); int TextLength = (int)TextSize.Width; int TextHeight = (int)TextSize.Height; if (TextLength + IconWidth + gripWidth + 2 > rect.Width && IconWidth > 20 && rect.Height > 36) { rect.Y += 20; rect.Height -= 20; } else { rect.X += IconWidth; rect.Width -= IconWidth; } gfx.DrawString(appointment.Title, this.BaseFont, SystemBrushes.WindowText, rect, m_AppointmentStringFormat); if (!String.IsNullOrEmpty(appointment.Description)) { rect.X = LeftX; rect.Y += TextHeight + 16; rect.Height -= TextHeight + 14; if (rect.Height > 12) { gfx.DrawString(appointment.Description, this.BaseFont, SystemBrushes.WindowText, rect, m_AppointmentStringFormat); } } }