public virtual void DrawDayGripper(IGUIContext gfx, RectangleF rect, int gripWidth) { using (var m_Brush = new SolidBrush(Color.White)) gfx.FillRectangle(m_Brush, rect.Left, rect.Top - 1, gripWidth, rect.Height); using (var m_Pen = new Pen(Color.Black)) gfx.DrawRectangle(m_Pen, rect.Left, rect.Top - 1, gripWidth, rect.Height); }
public override void DrawDayGripper(IGUIContext gfx, RectangleF rect, int gripWidth) { using (var m_Brush = new SolidBrush(BackColor)) { gfx.FillRectangle(m_Brush, rect.Left, rect.Top - 1, gripWidth, rect.Height + 1); } using (var m_Pen = new Pen(GripperBorderColor)) { gfx.DrawRectangle(m_Pen, rect.Left - 0.5f, rect.Top - 1, gripWidth, rect.Height + 1); } }
public virtual void DrawHourRange(IGUIContext gfx, System.Drawing.RectangleF rect, bool drawBorder, bool hilight, bool active) { using (var brush = new SolidBrush(hilight ? this.SelectionColor : this.WorkingHourColor)) { gfx.FillRectangle(brush, rect); } if (drawBorder) { using (var pen = new Pen(System.Drawing.Color.Gray)) gfx.DrawRectangle(pen, rect); } }
public virtual void DrawBorder(IGUIContext ctx, Widget widget) { if (BorderColorPen != null && BorderColorPen.Width > 0 && BorderColorPen.Color != Color.Empty) { RectangleF rBorder = widget.Bounds; if (Math.Abs(BorderDistance) > float.Epsilon) { rBorder.Inflate(BorderDistance, BorderDistance); } rBorder = rBorder.Ceil(); rBorder.Offset(-0.5f, -0.5f); ctx.DrawRectangle(BorderColorPen, rBorder); } }
public override void DrawHourRange(IGUIContext gfx, System.Drawing.RectangleF rect, bool drawBorder, bool highlight, bool active) { System.Drawing.Color c = highlight ? this.SelectionColor : this.WorkingHourColor; if (!active) { c = c.ToGray(); } using (var brush = new SolidBrush(c)) { gfx.FillRectangle(brush, rect); } if (drawBorder) { using (var pen = new Pen(System.Drawing.Color.FromArgb(194, 200, 208))) { gfx.DrawRectangle(pen, rect); } } }
public static void DrawButton(this IGUIContext ctx, RectangleF rect, Color TopColor, Color BottomColor, Color LineColor) { RectangleF topPart = new RectangleF(rect.Left, rect.Top, rect.Width, (int)(rect.Height * 3f / 5f) - 2); RectangleF lowPart = new RectangleF(topPart.Left, topPart.Bottom, topPart.Width, rect.Height - topPart.Height); int gradientHeight = (int)(topPart.Height / 3f) + 1; RectangleF gradientPart = new RectangleF(topPart.Left, topPart.Bottom - gradientHeight, topPart.Width, gradientHeight); if (topPart.Width > 0 && topPart.Height > 0) { using (var brush = new SolidBrush(TopColor)) { ctx.FillRectangle(brush, topPart); } } if (lowPart.Width > 0 && lowPart.Height > 0) { using (var brush = new SolidBrush(BottomColor)) { ctx.FillRectangle(brush, lowPart); } } if (gradientPart.Width > 0 && gradientPart.Height > 0) { using (var aGB = new LinearGradientBrush(TopColor, BottomColor, GradientDirections.Vertical)) { ctx.FillRectangle(aGB, gradientPart); } } if (rect.Width > 0 && rect.Height > 0) { using (var aPen = new Pen(LineColor)) { ctx.DrawRectangle(aPen, rect.Left - 0.5f, rect.Top - 0.5f, rect.Width, rect.Height); } } }
/** * public double XValue(GraphPoint point) * { * if (this.XAxisDataType == AxisDataTypes.axNumeric) * return (double)point.X; * else * return DoubleConvert.Date2Double((DateTime)(point.X)); * } **/ private void DrawNodes(IGUIContext ctx, RectangleF bounds) { int OldNumberOfPoints = CurrentNumberOfPoints; CurrentNumberOfPoints = 0; if (Graph == null) { if (OldNumberOfPoints != 0) { if (PointCountChangedEvent != null) { PointCountChangedEvent(); } } return; } PointF p; bool bInterpolated = false; // int ListID; Color C; float offsetX = bounds.X; float offsetY = bounds.Y; if (Graph.Visible) { if (Graph.Points.Count > 1) { DrawGraphLine(ctx, Graph, bounds); } foreach (GraphPoint gp in Graph.Points) { p = Point2Client((double)gp.X, (double)gp.Y, bounds).Add(offsetX, offsetY); if (!Bounds.IntersectsWith(new RectangleF(p.X, p.Y, 1, 1))) { continue; } bInterpolated = Graph.GraphType == GraphTypes.gtInterpolation; C = Graph.GraphColor; Pen pen = new Pen(Color.White); SolidBrush brush = new SolidBrush(C); SolidBrush whitebrush = new SolidBrush(Color.White); try { if (bInterpolated) { float PointWidth = PointRadius * 2f; ctx.DrawRectangle(pen, p.X - PointRadius, p.Y - PointRadius, PointWidth, PointWidth); if (gp == PointCatched) { ctx.DrawRectangle(pen, p.X - PointRadius - 1, p.Y - PointRadius - 1, PointWidth + 2, PointWidth + 2); } } else { float Radius = PointRadius / 2f;; float width; if (gp == PointCatched) { width = 4f.Scale(ScaleFactor); } else { width = 3f.Scale(ScaleFactor); } ctx.FillEllipse(brush, p.X, p.Y, Radius + width, Radius + width); width = 1.5f.Scale(ScaleFactor); ctx.FillEllipse(whitebrush, p.X, p.Y, Radius + width, Radius + width); ctx.FillEllipse(brush, p.X, p.Y, Radius, Radius); } } catch { } pen.Dispose(); brush.Dispose(); CurrentNumberOfPoints++; } } if (CurrentNumberOfPoints != OldNumberOfPoints) { if (PointCountChangedEvent != null) { PointCountChangedEvent(); } } }
//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); } } }