private void DrawBorders(FRPaintEventArgs e, TableCell cell) { cell.Border.Draw(e, cell.AbsBounds); }
private void DrawFill(FRPaintEventArgs e, TableCell cell) { cell.DrawBackground(e); }
private void DrawText(FRPaintEventArgs e, TableCell cell) { cell.DrawText(e); }
/// <summary> /// Draws the gauge label. /// </summary> /// <param name="e">Draw event arguments.</param> public virtual void Draw(FRPaintEventArgs e) { }
/// <inheritdoc/> public override void Draw(FRPaintEventArgs e) { base.Draw(e); DrawHorz(e); }
/// <summary> /// Does nothing /// </summary> /// <param name="e"></param> private void DrawDesign_SelectedCellsRtl(FRPaintEventArgs e) { }
private void DrawMajorTicks(FRPaintEventArgs e) { center = (Parent as RadialGauge).Center; stepValue = (Parent.Maximum - Parent.Minimum) / (MajorTicks.Count - 1); if (RadialUtils.IsQuadrant(Parent)) { stepValue *= 2; } avrValue = Parent.Minimum + (Parent.Maximum - Parent.Minimum) / 2; bool isRightPart = true; bool isLeftPart = false; PointF txtPoint; IGraphics g = e.Graphics; Pen pen = e.Cache.GetPen(MajorTicks.Color, MajorTicks.Width * e.ScaleX, DashStyle.Solid); Brush brush = TextFill.CreateBrush(new RectangleF(Parent.AbsLeft * e.ScaleX, Parent.AbsTop * e.ScaleY, Parent.Width * e.ScaleX, Parent.Height * e.ScaleY), e.ScaleX, e.ScaleY); sideTicksCount = (MajorTicks.Count - 1) / 2; MajorTicks.Length = width / 12; SizeF maxTxt = RadialUtils.GetStringSize(e, Parent, Font, Parent.Maximum.ToString()); SizeF minTxt = RadialUtils.GetStringSize(e, Parent, Font, Parent.Minimum.ToString()); float maxTxtOffset = maxTxt.Height > maxTxt.Width ? maxTxt.Height : maxTxt.Width; float minTxtOffset = minTxt.Height > minTxt.Width ? minTxt.Height : minTxt.Width; majorTicksOffset = maxTxtOffset > minTxtOffset ? maxTxtOffset : minTxtOffset; PointF[] tick0 = new PointF[2]; avrTick = new PointF(left + width / 2, top + majorTicksOffset); //first tick tick0[0] = avrTick; tick0[1] = new PointF(tick0[0].X, tick0[0].Y + MajorTicks.Length); double angle = 0; HorAlign horAlign = HorAlign.Middle; VertAlign vertAlign = VertAlign.Bottom; double startValue = avrValue; if (RadialUtils.IsSemicircle(Parent)) { drawRight = true; drawLeft = true; if (RadialUtils.IsBottom(Parent)) { angle = 180 * RadialGauge.Radians; horAlign = HorAlign.Middle; vertAlign = VertAlign.Top; majorStep *= -1; isRightPart = true; isLeftPart = false; } else if (RadialUtils.IsLeft(Parent)) { angle = -90 * RadialGauge.Radians; horAlign = HorAlign.Right; vertAlign = VertAlign.Middle; isRightPart = false; isLeftPart = false; } else if (RadialUtils.IsRight(Parent)) { angle = 90 * RadialGauge.Radians; horAlign = HorAlign.Left; vertAlign = VertAlign.Middle; majorStep *= -1; isRightPart = true; //false isLeftPart = true; // false } } else if (RadialUtils.IsQuadrant(Parent)) { if (RadialUtils.IsTop(Parent) && RadialUtils.IsLeft(Parent)) { startValue = Parent.Maximum; //angle = 180 * RadialGauge.Radians; horAlign = HorAlign.Middle; vertAlign = VertAlign.Bottom; //majorStep *= -1; //isRightPart = true; //isLeftPart = false; drawRight = false; drawLeft = true; isRightPart = false; isLeftPart = false; } else if (RadialUtils.IsBottom(Parent) && RadialUtils.IsLeft(Parent)) { startValue = Parent.Minimum; angle = 180 * RadialGauge.Radians; horAlign = HorAlign.Middle; vertAlign = VertAlign.Top; drawRight = true; drawLeft = false; isRightPart = false; isLeftPart = false; } else if (RadialUtils.IsTop(Parent) && RadialUtils.IsRight(Parent)) { stepValue *= -1; startValue = Parent.Maximum; angle = 0; horAlign = HorAlign.Middle; vertAlign = VertAlign.Bottom; drawRight = true; drawLeft = false; isRightPart = true; isLeftPart = true; } else if (RadialUtils.IsBottom(Parent) && RadialUtils.IsRight(Parent)) { stepValue *= -1; startValue = Parent.Minimum; angle = 180 * RadialGauge.Radians; horAlign = HorAlign.Middle; vertAlign = VertAlign.Top; drawRight = false; drawLeft = true; isRightPart = true; isLeftPart = true; } } else { drawRight = true; drawLeft = true; } tick0 = RadialUtils.RotateVector(tick0, angle, center); g.DrawLine(pen, tick0[0].X, tick0[0].Y, tick0[1].X, tick0[1].Y); string text = startValue.ToString(); DrawText(e, text, brush, tick0[0].X, tick0[0].Y, horAlign, vertAlign); //rest of ticks PointF[] tick = new PointF[2]; angle = majorStep * RadialGauge.Radians; for (int i = 0; i < sideTicksCount; i++) { //right side if (drawRight) { tick = RadialUtils.RotateVector(tick0, angle, center); g.DrawLine(pen, tick[0].X, tick[0].Y, tick[1].X, tick[1].Y); text = Convert.ToString(Math.Round(startValue + stepValue * (i + 1))); if (i == sideTicksCount / 2) { if (RadialUtils.IsSemicircle(Parent) || RadialUtils.IsQuadrant(Parent)) { if (RadialUtils.IsLeft(Parent) && RadialUtils.IsTop(Parent)) { horAlign = HorAlign.Right; vertAlign = VertAlign.Middle; } else if (RadialUtils.IsLeft(Parent) && RadialUtils.IsBottom(Parent)) { horAlign = HorAlign.Right; vertAlign = VertAlign.Middle; } else if (RadialUtils.IsRight(Parent) && RadialUtils.IsTop(Parent)) { horAlign = HorAlign.Left; vertAlign = VertAlign.Middle; } else if (RadialUtils.IsLeft(Parent)) { horAlign = HorAlign.Middle; vertAlign = VertAlign.Bottom; } else if (RadialUtils.IsRight(Parent)) { horAlign = HorAlign.Middle; vertAlign = VertAlign.Bottom; } else { horAlign = HorAlign.Left; vertAlign = VertAlign.Middle; } } else { horAlign = HorAlign.Left; vertAlign = VertAlign.Middle; } } else if (i < sideTicksCount / 2) { horAlign = HorAlign.Left; if (RadialUtils.IsSemicircle(Parent) || RadialUtils.IsQuadrant(Parent)) { if (RadialUtils.IsLeft(Parent) && RadialUtils.IsTop(Parent)) { horAlign = HorAlign.Right; vertAlign = VertAlign.Middle; } if (RadialUtils.IsLeft(Parent) && RadialUtils.IsBottom(Parent)) { vertAlign = VertAlign.Top; horAlign = HorAlign.Right; } else if (RadialUtils.IsBottom(Parent)) { vertAlign = VertAlign.Top; } else if (RadialUtils.IsLeft(Parent)) { horAlign = HorAlign.Right; vertAlign = VertAlign.Bottom; } else if (RadialUtils.IsRight(Parent)) { horAlign = HorAlign.Left; vertAlign = VertAlign.Bottom; } } else { vertAlign = VertAlign.Bottom; } } else { horAlign = HorAlign.Left; vertAlign = VertAlign.Top; } txtPoint = GetTextPoint(tick, -1 * e.ScaleX, isNegative(i, true), isRightPart); DrawText(e, text, brush, txtPoint.X, txtPoint.Y, horAlign, vertAlign); } if (drawLeft) { //left side angle *= -1; tick = RadialUtils.RotateVector(tick0, angle, center); g.DrawLine(pen, tick[0].X, tick[0].Y, tick[1].X, tick[1].Y); text = Convert.ToString(Math.Round(startValue - stepValue * (i + 1))); if (i == sideTicksCount / 2) { if (RadialUtils.IsSemicircle(Parent) || RadialUtils.IsQuadrant(Parent)) { if ((RadialUtils.IsTop(Parent) || RadialUtils.IsBottom(Parent)) && RadialUtils.IsSemicircle(Parent)) { horAlign = HorAlign.Right; vertAlign = VertAlign.Middle; } else if (RadialUtils.IsLeft(Parent) && RadialUtils.IsTop(Parent)) { horAlign = HorAlign.Right; vertAlign = VertAlign.Middle; } else if (RadialUtils.IsRight(Parent) && RadialUtils.IsBottom(Parent)) { horAlign = HorAlign.Left; vertAlign = VertAlign.Middle; } else if (RadialUtils.IsLeft(Parent)) { horAlign = HorAlign.Middle; vertAlign = VertAlign.Top; } else if (RadialUtils.IsRight(Parent)) { horAlign = HorAlign.Middle; vertAlign = VertAlign.Top; } } else { horAlign = HorAlign.Right; vertAlign = VertAlign.Middle; } } else if (i < sideTicksCount / 2) { horAlign = HorAlign.Right; if (RadialUtils.IsSemicircle(Parent) || RadialUtils.IsQuadrant(Parent)) { if (RadialUtils.IsRight(Parent) && RadialUtils.IsBottom(Parent)) { vertAlign = VertAlign.Top; horAlign = HorAlign.Left; } else if (RadialUtils.IsTop(Parent) && RadialUtils.IsLeft(Parent)) { vertAlign = VertAlign.Bottom; horAlign = HorAlign.Right; } else if (RadialUtils.IsBottom(Parent)) { vertAlign = VertAlign.Top; } else if (RadialUtils.IsLeft(Parent)) { horAlign = HorAlign.Right; vertAlign = VertAlign.Top; } else if (RadialUtils.IsRight(Parent)) { horAlign = HorAlign.Left; vertAlign = VertAlign.Top; } } else { vertAlign = VertAlign.Bottom; } } else { horAlign = HorAlign.Right; vertAlign = VertAlign.Top; } txtPoint = GetTextPoint(tick, -1 * e.ScaleX, isNegative(i, false), isLeftPart); DrawText(e, text, brush, txtPoint.X, txtPoint.Y, horAlign, vertAlign); angle *= -1; } angle += majorStep * RadialGauge.Radians; } }
/// <inheritdoc/> public override void Draw(FRPaintEventArgs e) { DrawBackground(e); base.Draw(e); }
private void DrawDesign(FRPaintEventArgs e) { //DrawDragAcceptFrame(e, Color.Silver); }
public static SizeF GetStringSize(FRPaintEventArgs e, GaugeObject gauge, Font font, string text) { return(e.Graphics.MeasureString(text, GetFont(e, gauge, font))); }
public static Font GetFont(FRPaintEventArgs e, GaugeObject gauge, Font font) { return(e.Cache.GetFont(font.FontFamily, gauge.IsPrinting ? font.Size : font.Size *e.ScaleX * 96f / DrawUtils.ScreenDpi, font.Style)); }
public override void PrintPage(object sender, PrintPageEventArgs e) { StartPage(e); if (Page != null) { int countX = 0; int countY = 0; float scale = 0; // switch dimensions because FSheetWidth, FSheetHeight is a portrait dimensions float sheetWidth = Report.PrintSettings.PrintOnSheetWidth; float sheetHeight = Report.PrintSettings.PrintOnSheetHeight; if (Page.Landscape && Page.PaperWidth > Page.PaperHeight) { sheetWidth = Report.PrintSettings.PrintOnSheetHeight; sheetHeight = Report.PrintSettings.PrintOnSheetWidth; } switch (Report.PrintSettings.PagesOnSheet) { case PagesOnSheet.One: countX = 1; countY = 1; scale = Math.Min(sheetWidth / Page.PaperWidth, sheetHeight / Page.PaperHeight); break; case PagesOnSheet.Two: countX = 2; countY = 1; scale = Math.Min(sheetHeight / Page.PaperWidth, sheetWidth / Page.PaperHeight); break; case PagesOnSheet.Four: countX = 2; countY = 2; scale = Math.Min(sheetWidth / Page.PaperWidth, sheetHeight / Page.PaperHeight) / 2; break; case PagesOnSheet.Eight: countX = 4; countY = 2; scale = Math.Min(sheetHeight / Page.PaperWidth, sheetWidth / Page.PaperHeight) / 2; break; } float pieceX = Page.PaperWidth * scale; float pieceY = Page.PaperHeight * scale; float leftMargin = e.PageSettings.HardMarginX / 100f * 25.4f; float topMargin = e.PageSettings.HardMarginY / 100f * 25.4f; float offsY = -topMargin; for (int y = 0; y < countY; y++) { float offsX = -leftMargin; for (int x = 0; x < countX; x++) { Graphics g = e.Graphics; GraphicsState state = g.Save(); try { g.PageUnit = GraphicsUnit.Pixel; g.TranslateTransform(offsX * Units.Millimeters * g.DpiX / 96, offsY * Units.Millimeters * g.DpiY / 96); g.ScaleTransform(scale, scale); FRPaintEventArgs paintArgs = new FRPaintEventArgs(g, g.DpiX / 96, g.DpiY / 96, Report.GraphicCache); Page.Print(paintArgs); } finally { g.Restore(state); } offsX += pieceX; Page.Dispose(); Page = GetNextPage(); if (Page == null) { break; } } if (Page == null) { break; } offsY += pieceY; } } FinishPage(e); e.HasMorePages = Page != null; }
/// <summary> /// Draws a text. /// </summary> /// <param name="e">Paint event data.</param> public void DrawText(FRPaintEventArgs e) { if (!String.IsNullOrEmpty(Text)) { Graphics g = e.Graphics; RectangleF textRect = new RectangleF( (AbsLeft + Padding.Left) * e.ScaleX, (AbsTop + Padding.Top) * e.ScaleY, (Width - Padding.Horizontal) * e.ScaleX, (Height - Padding.Vertical) * e.ScaleY); StringFormat format = GetStringFormat(e.Cache, 0); Font font = e.Cache.GetFont(Font.Name, IsPrinting ? Font.Size : Font.Size * e.ScaleX * 96f / DrawUtils.ScreenDpi, Font.Style); Brush textBrush = null; if (TextFill is SolidFill) { textBrush = e.Cache.GetBrush((TextFill as SolidFill).Color); } else { textBrush = TextFill.CreateBrush(textRect); } Report report = Report; if (report != null && report.TextQuality != TextQuality.Default) { g.TextRenderingHint = GetTextQuality(report.TextQuality); } if (textRect.Width > 0 && textRect.Height > 0) { if (LineHeight == 0 && HorzAlign != HorzAlign.Justify && !Wysiwyg && !HtmlTags) { // use simple rendering if (Angle == 0 && FontWidthRatio == 1) { g.DrawString(Text, font, textBrush, textRect, format); } else { StandardTextRenderer.Draw(Text, g, font, textBrush, textRect, format, Angle, FontWidthRatio); } } else { // use advanced rendering AdvancedTextRenderer renderer = new AdvancedTextRenderer(Text, g, font, textBrush, textRect, format, HorzAlign, VertAlign, LineHeight * e.ScaleY, Angle, FontWidthRatio, ForceJustify, Wysiwyg, HtmlTags, false); renderer.Draw(); } } if (!(TextFill is SolidFill)) { textBrush.Dispose(); } if (report != null && report.TextQuality != TextQuality.Default) { g.TextRenderingHint = TextRenderingHint.SystemDefault; } } DrawUnderlines(e); }
private void DrawHorz(FRPaintEventArgs e) { IGraphics g = e.Graphics; Pen pen = e.Cache.GetPen(BorderColor, BorderWidth * e.ScaleX, DashStyle.Solid); PointF center = (Parent as RadialGauge).Center; float circleWidth = Parent.Width / 16f; float circleHeight = Parent.Height / 16f; RectangleF pointerCircle = new RectangleF(center.X - circleWidth / 2 * e.ScaleX, center.Y - circleHeight / 2 * e.ScaleY, circleWidth * e.ScaleX, circleHeight * e.ScaleY); //double rotateTo = (scale.AverageValue - Parent.Minimum); double startAngle = -135 * RadialGauge.Radians; double angle = (Parent.Value - Parent.Minimum) / scale.StepValue * scale.MajorStep * RadialGauge.Radians; if ((Parent as RadialGauge).Type == RadialGaugeType.Semicircle) { if ((Parent as RadialGauge).Position == RadialGaugePosition.Bottom || (Parent as RadialGauge).Position == RadialGaugePosition.Top) { startAngle = -90 * RadialGauge.Radians; if ((Parent as RadialGauge).Position == RadialGaugePosition.Bottom) { angle *= -1; } } else if ((Parent as RadialGauge).Position == RadialGaugePosition.Left) { startAngle = -180 * RadialGauge.Radians; } else if ((Parent as RadialGauge).Position == RadialGaugePosition.Right) { startAngle = -180 * RadialGauge.Radians; angle *= -1; } } else if (RadialUtils.IsQuadrant(Parent)) { if (RadialUtils.IsLeft(Parent) && RadialUtils.IsTop(Parent)) { startAngle = -90 * RadialGauge.Radians; } else if (RadialUtils.IsLeft(Parent) && RadialUtils.IsBottom(Parent)) { startAngle = -180 * RadialGauge.Radians; } else if (RadialUtils.IsRight(Parent) && RadialUtils.IsTop(Parent)) { startAngle = 90 * RadialGauge.Radians; } else if (RadialUtils.IsRight(Parent) && RadialUtils.IsBottom(Parent)) { startAngle = 180 * RadialGauge.Radians; angle *= -1; } } //double startAngle = rotateTo / scale.StepValue * -scale.MajorStep * RadialGauge.Radians; float ptrLineY = center.Y - pointerCircle.Width / 2 - pointerCircle.Width / 5; float ptrLineY1 = scale.AvrTick.Y + scale.MinorTicks.Length * 1.7f; float ptrLineWidth = circleWidth / 3 * e.ScaleX; PointF[] pointerPerpStrt = new PointF[2]; pointerPerpStrt[0] = new PointF(center.X - ptrLineWidth, ptrLineY); pointerPerpStrt[1] = new PointF(center.X + ptrLineWidth, ptrLineY); PointF[] pointerPerpEnd = new PointF[2]; pointerPerpEnd[0] = new PointF(center.X - ptrLineWidth / 3, ptrLineY1); pointerPerpEnd[1] = new PointF(center.X + ptrLineWidth / 3, ptrLineY1); pointerPerpStrt = RadialUtils.RotateVector(pointerPerpStrt, startAngle, center); pointerPerpEnd = RadialUtils.RotateVector(pointerPerpEnd, startAngle, center); PointF[] rotatedPointerPerpStrt = RadialUtils.RotateVector(pointerPerpStrt, angle, center); PointF[] rotatedPointerPerpEnd = RadialUtils.RotateVector(pointerPerpEnd, angle, center); //calc brush rect float x = 0, y = 0, dx = 0, dy = 0; if (angle / RadialGauge.Radians >= 0 && angle / RadialGauge.Radians < 45) { x = rotatedPointerPerpEnd[1].X; y = rotatedPointerPerpEnd[0].Y - (rotatedPointerPerpEnd[0].Y - pointerCircle.Y); dx = pointerCircle.X + pointerCircle.Width - rotatedPointerPerpEnd[0].X; dy = rotatedPointerPerpEnd[0].Y - pointerCircle.Y; } else if (angle / RadialGauge.Radians >= 45 && angle / RadialGauge.Radians < 90) { x = rotatedPointerPerpEnd[0].X; y = rotatedPointerPerpEnd[1].Y; dx = pointerCircle.X + pointerCircle.Width - rotatedPointerPerpEnd[0].X; dy = pointerCircle.Y + pointerCircle.Height - rotatedPointerPerpEnd[0].Y; } else if (angle / RadialGauge.Radians >= 90 && angle / RadialGauge.Radians < 135) { x = rotatedPointerPerpEnd[0].X; y = rotatedPointerPerpEnd[1].Y; dx = pointerCircle.X + pointerCircle.Width - rotatedPointerPerpEnd[0].X; dy = pointerCircle.Y + pointerCircle.Height - rotatedPointerPerpEnd[1].Y; } else if (angle / RadialGauge.Radians >= 135 && angle / RadialGauge.Radians < 225) { x = pointerCircle.X; y = rotatedPointerPerpEnd[0].Y; dx = rotatedPointerPerpEnd[1].X - pointerCircle.X; dy = pointerCircle.Y + pointerCircle.Height - rotatedPointerPerpEnd[0].Y; } else if (angle / RadialGauge.Radians >= 225) { x = pointerCircle.X; y = pointerCircle.Y; dx = rotatedPointerPerpEnd[0].X - pointerCircle.X; dy = rotatedPointerPerpEnd[1].Y - pointerCircle.Y; } RectangleF brushRect = new RectangleF(x, y, dx, dy); if (gradAutoRotate && Fill is LinearGradientFill) { (Fill as LinearGradientFill).Angle = (int)(startAngle / RadialGauge.Radians + angle / RadialGauge.Radians) + 90; } Brush brush = Fill.CreateBrush(brushRect, e.ScaleX, e.ScaleY); PointF[] p = new PointF[] { rotatedPointerPerpStrt[0], rotatedPointerPerpStrt[1], rotatedPointerPerpEnd[1], rotatedPointerPerpEnd[0], }; GraphicsPath path = new GraphicsPath(); path.AddLines(p); path.AddLine(p[3], p[0]); g.FillEllipse(brush, pointerCircle); g.DrawEllipse(pen, pointerCircle); g.FillPath(brush, path); g.DrawPath(pen, path); }
/// <summary> /// Does nothing /// </summary> /// <param name="e"></param> private void DrawDesign(FRPaintEventArgs e) { }
/// <inheritdoc/> public override void Draw(FRPaintEventArgs e) { Graphics g = e.Graphics; // draw marker when inserting a line if (Width == 0 && Height == 0) { g.DrawLine(Pens.Black, AbsLeft * e.ScaleX - 6, AbsTop * e.ScaleY, AbsLeft * e.ScaleX + 6, AbsTop * e.ScaleY); g.DrawLine(Pens.Black, AbsLeft * e.ScaleX, AbsTop * e.ScaleY - 6, AbsLeft * e.ScaleX, AbsTop * e.ScaleY + 6); return; } Report report = Report; if (report != null && report.SmoothGraphics) { g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.SmoothingMode = SmoothingMode.AntiAlias; } Pen pen; if (StartCap.Style == CapStyle.None && EndCap.Style == CapStyle.None) { pen = e.Cache.GetPen(Border.Color, Border.Width * e.ScaleX, Border.DashStyle); } else { pen = new Pen(Border.Color, Border.Width * e.ScaleX); pen.DashStyle = Border.DashStyle; CustomLineCap startCap = StartCap.Cap; CustomLineCap endCap = EndCap.Cap; if (startCap != null) { pen.CustomStartCap = startCap; } if (endCap != null) { pen.CustomEndCap = endCap; } } float width = Width; float height = Height; if (!Diagonal) { if (Math.Abs(width) > Math.Abs(height)) { height = 0; } else { width = 0; } } g.DrawLine(pen, AbsLeft * e.ScaleX, AbsTop * e.ScaleY, (AbsLeft + width) * e.ScaleX, (AbsTop + height) * e.ScaleY); if (StartCap.Style != CapStyle.None || EndCap.Style != CapStyle.None) { pen.Dispose(); } if (report != null && report.SmoothGraphics && Diagonal) { g.InterpolationMode = InterpolationMode.Default; g.SmoothingMode = SmoothingMode.Default; } }
/// <summary> /// Does nothing /// </summary> /// <param name="e"></param> private void DrawDesign_BordersRtl(FRPaintEventArgs e) { }
private void DrawCheck(FRPaintEventArgs e) { RectangleF drawRect = new RectangleF(AbsLeft * e.ScaleX, AbsTop * e.ScaleY, Width * e.ScaleX, Height * e.ScaleY); float ratio = Width / (Units.Millimeters * 5); drawRect.Inflate(-4 * ratio * e.ScaleX, -4 * ratio * e.ScaleY); Pen pen = e.Cache.GetPen(CheckColor, 1.6f * ratio * CheckWidthRatio * e.ScaleX, DashStyle.Solid); Graphics g = e.Graphics; SmoothingMode saveSmoothing = g.SmoothingMode; g.SmoothingMode = SmoothingMode.AntiAlias; if (Checked) { switch (CheckedSymbol) { case CheckedSymbol.Check: g.DrawLines(pen, new PointF[] { new PointF(drawRect.Left, drawRect.Top + drawRect.Height / 10 * 5), new PointF(drawRect.Left + drawRect.Width / 10 * 4, drawRect.Bottom - drawRect.Height / 10), new PointF(drawRect.Right, drawRect.Top + drawRect.Height / 10) }); break; case CheckedSymbol.Cross: g.DrawLine(pen, drawRect.Left, drawRect.Top, drawRect.Right, drawRect.Bottom); g.DrawLine(pen, drawRect.Left, drawRect.Bottom, drawRect.Right, drawRect.Top); break; case CheckedSymbol.Plus: g.DrawLine(pen, drawRect.Left, drawRect.Top + drawRect.Height / 2, drawRect.Right, drawRect.Top + drawRect.Height / 2); g.DrawLine(pen, drawRect.Left + drawRect.Width / 2, drawRect.Top, drawRect.Left + drawRect.Width / 2, drawRect.Bottom); break; case CheckedSymbol.Fill: Brush brush = e.Cache.GetBrush(CheckColor); g.FillRectangle(brush, drawRect); break; } } else { switch (UncheckedSymbol) { case UncheckedSymbol.Cross: g.DrawLine(pen, drawRect.Left, drawRect.Top, drawRect.Right, drawRect.Bottom); g.DrawLine(pen, drawRect.Left, drawRect.Bottom, drawRect.Right, drawRect.Top); break; case UncheckedSymbol.Minus: g.DrawLine(pen, drawRect.Left, drawRect.Top + drawRect.Height / 2, drawRect.Right, drawRect.Top + drawRect.Height / 2); break; case UncheckedSymbol.Slash: g.DrawLine(pen, drawRect.Left, drawRect.Bottom, drawRect.Right, drawRect.Top); break; case UncheckedSymbol.BackSlash: g.DrawLine(pen, drawRect.Left, drawRect.Top, drawRect.Right, drawRect.Bottom); break; } } g.SmoothingMode = saveSmoothing; }
public abstract void DrawImage(FRPaintEventArgs e);
/// <inheritdoc/> public override void Draw(FRPaintEventArgs e) { if (IsDesigning) { return; } Graphics g = e.Graphics; RectangleF pageRect = new RectangleF(0, 0, WidthInPixels - 1 / e.ScaleX, HeightInPixels - 1 / e.ScaleY); RectangleF printableRect = new RectangleF( LeftMargin * Units.Millimeters, TopMargin * Units.Millimeters, (PaperWidth - LeftMargin - RightMargin) * Units.Millimeters, (PaperHeight - TopMargin - BottomMargin) * Units.Millimeters); DrawBackground(e, pageRect); Border.Draw(e, printableRect); if (Watermark.Enabled) { if (!Watermark.ShowImageOnTop) { Watermark.DrawImage(e, pageRect, Report, IsPrinting); } if (!Watermark.ShowTextOnTop) { Watermark.DrawText(e, pageRect, Report, IsPrinting); } } float leftMargin = (int)Math.Round(LeftMargin * Units.Millimeters * e.ScaleX); float topMargin = (int)Math.Round(TopMargin * Units.Millimeters * e.ScaleY); g.TranslateTransform(leftMargin, topMargin); try { foreach (Base c in AllObjects) { if (c is ReportComponentBase && c.HasFlag(Flags.CanDraw)) { ReportComponentBase obj = c as ReportComponentBase; if (!IsPrinting) { if (!obj.IsVisible(e)) { continue; } } else { if (!obj.Printable) { continue; } else if (obj.Parent is BandBase && !(obj.Parent as BandBase).Printable) { continue; } } obj.SetDesigning(false); obj.SetPrinting(IsPrinting); obj.Draw(e); obj.SetPrinting(false); } } } finally { g.TranslateTransform(-leftMargin, -topMargin); } if (Watermark.Enabled) { if (Watermark.ShowImageOnTop) { Watermark.DrawImage(e, pageRect, Report, IsPrinting); } if (Watermark.ShowTextOnTop) { Watermark.DrawText(e, pageRect, Report, IsPrinting); } } }
private void DrawMinorTicks(FRPaintEventArgs e) { IGraphics g = e.Graphics; Pen pen = e.Cache.GetPen(MinorTicks.Color, MinorTicks.Width * e.ScaleX, DashStyle.Solid); MinorTicks.Length = width / 24; minorTicksOffset = majorTicksOffset + MajorTicks.Length / 2 - MinorTicks.Length / 2; PointF center = new PointF(left + width / 2, top + height / 2); PointF[] tick0 = new PointF[2]; //first tick tick0[0] = new PointF(left + width / 2, top + minorTicksOffset); tick0[1] = new PointF(tick0[0].X, tick0[0].Y + MinorTicks.Length); double angle = 0; if (RadialUtils.IsSemicircle(Parent) || RadialUtils.IsQuadrant(Parent)) { if (RadialUtils.IsBottom(Parent) && RadialUtils.IsLeft(Parent)) { angle = -180 * RadialGauge.Radians; } else if (RadialUtils.IsTop(Parent) && RadialUtils.IsLeft(Parent)) { angle = 0; } else if (RadialUtils.IsTop(Parent) && RadialUtils.IsRight(Parent)) { angle = 0; } else if (RadialUtils.IsBottom(Parent)) { angle = 180 * RadialGauge.Radians; majorStep *= -1; } else if (RadialUtils.IsLeft(Parent)) { angle = -90 * RadialGauge.Radians; } else if (RadialUtils.IsRight(Parent)) { angle = 90 * RadialGauge.Radians; majorStep *= -1; } } tick0 = RadialUtils.RotateVector(tick0, angle, center); //rest of ticks PointF[] tick = new PointF[2]; angle = minorStep * RadialGauge.Radians; for (int i = 0; i < MajorTicks.Count / 2 * (MinorTicks.Count + 1); i++) { if ((i + 1) % (MinorTicks.Count + 1) != 0) { if (drawRight) { tick = RadialUtils.RotateVector(tick0, angle, center); g.DrawLine(pen, tick[0].X, tick[0].Y, tick[1].X, tick[1].Y); } if (drawLeft) { angle *= -1; tick = RadialUtils.RotateVector(tick0, angle, center); g.DrawLine(pen, tick[0].X, tick[0].Y, tick[1].X, tick[1].Y); angle *= -1; } } angle += minorStep * RadialGauge.Radians; } }
private void DrawCellsRtl(FRPaintEventArgs e, DrawCellProc proc) { float top = 0; for (int y = 0; y < Rows.Count; y++) { float left = 0; float height = Rows[y].Height; //bool thereIsColSpan = false; //for (int i = Columns.Count - 1; i >= 0; i--) //{ // TableCell cell = this[i, y]; // if (cell.ColSpan > 1) // { // thereIsColSpan = true; // } //} for (int x = Columns.Count - 1; x >= 0; x--) { TableCell cell = this[x, y]; bool thereIsColSpan = false; if (cell.ColSpan > 1) { thereIsColSpan = true; } float width = Columns[x].Width; //if (thereIsColSpan) //{ // width *= cell.ColSpan - 1; // left -= width; //} if (!IsInsideSpan(cell) && (!IsPrinting || cell.Printable)) { cell.Left = left; cell.Top = top; cell.SetPrinting(IsPrinting); proc(e, cell); if (thereIsColSpan) { width *= cell.ColSpan; } left += width; } //if (!thereIsColSpan) // left += width; //else // left -= width; } top += height; } }
internal void Draw(FRPaintEventArgs e, float x, float y, float x1, float y1, bool reverseGaps, bool gap1, bool gap2) { Graphics g = e.Graphics; int penWidth = (int)Math.Round(Width * e.ScaleX); if (penWidth <= 0) { penWidth = 1; } using (Pen pen = new Pen(Color, penWidth)) { pen.DashStyle = DashStyle; pen.StartCap = LineCap.Square; pen.EndCap = LineCap.Square; if (pen.DashStyle != DashStyle.Solid) { float patternWidth = 0; foreach (float w in pen.DashPattern) { patternWidth += w * pen.Width; } if (y == y1) { pen.DashOffset = (x - ((int)(x / patternWidth)) * patternWidth) / pen.Width; } else { pen.DashOffset = (y - ((int)(y / patternWidth)) * patternWidth) / pen.Width; } } if (Style != LineStyle.Double) { g.DrawLine(pen, x, y, x1, y1); } else { // we have to correctly draw inner and outer lines of a double line float g1 = gap1 ? pen.Width : 0; float g2 = gap2 ? pen.Width : 0; float g3 = -g1; float g4 = -g2; if (reverseGaps) { g1 = -g1; g2 = -g2; g3 = -g3; g4 = -g4; } if (x == x1) { g.DrawLine(pen, x - pen.Width, y + g1, x1 - pen.Width, y1 - g2); g.DrawLine(pen, x + pen.Width, y + g3, x1 + pen.Width, y1 - g4); } else { g.DrawLine(pen, x + g1, y - pen.Width, x1 - g2, y1 - pen.Width); g.DrawLine(pen, x + g3, y + pen.Width, x1 - g4, y1 + pen.Width); } } } }
/// <summary> /// Does nothing /// </summary> /// <param name="e">Draw event arguments.</param> public void DrawMarkers(FRPaintEventArgs e) { }