private void DrawMajorTicksVert(FRPaintEventArgs e) { Graphics 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); float y = top + height; float x1 = left; float x2 = left + width; float step = height / (majorTicksNum - 1); int textStep = (int)((Parent.Maximum - Parent.Minimum) / (majorTicksNum - 1)); Font font = e.Cache.GetFont(Font.Name, Parent.IsPrinting ? Font.Size : Font.Size * e.ScaleX * 96f / DrawUtils.ScreenDpi, Font.Style); string text = Parent.Minimum.ToString(); for (int i = 0; i < majorTicksNum; i++) { g.DrawLine(pen, x1, y, x2, y); SizeF strSize = g.MeasureString(text, Font); float x3 = x1 - strSize.Width * e.ScaleX - 0.04f * Units.Centimeters * e.ScaleX; if ((Parent as LinearGauge).Inverted) { x3 = x2 + 0.04f * Units.Centimeters * e.ScaleX; } g.DrawString(text, font, brush, x3, y - strSize.Height / 2 * e.ScaleY); text = Convert.ToString(textStep * (i + 1) + Parent.Minimum); y -= step; } brush.Dispose(); }
/// <summary> /// Serializes the style. /// </summary> /// <param name="writer">Writer object.</param> /// <remarks> /// This method is for internal use only. /// </remarks> public virtual void Serialize(FRWriter writer) { StyleBase c = writer.DiffObject as StyleBase; Border.Serialize(writer, "Border", c.Border); Fill.Serialize(writer, "Fill", c.Fill); TextFill.Serialize(writer, "TextFill", c.TextFill); if (!Font.Equals(c.Font)) { writer.WriteValue("Font", Font); } if (ApplyBorder != c.ApplyBorder) { writer.WriteBool("ApplyBorder", ApplyBorder); } if (ApplyFill != c.ApplyFill) { writer.WriteBool("ApplyFill", ApplyFill); } if (ApplyTextFill != c.ApplyTextFill) { writer.WriteBool("ApplyTextFill", ApplyTextFill); } if (ApplyFont != c.ApplyFont) { writer.WriteBool("ApplyFont", ApplyFont); } }
private void DrawMajorTicksHorz(FRPaintEventArgs e) { Graphics 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); float x = left; float y1 = top; float y2 = top + height; float step = width / (majorTicksNum - 1); int textStep = (int)((Parent.Maximum - Parent.Minimum) / (majorTicksNum - 1)); Font font = e.Cache.GetFont(Font.Name, Parent.IsPrinting ? Font.Size : Font.Size * e.ScaleX * 96f / DrawUtils.ScreenDpi, Font.Style); string text = Parent.Minimum.ToString(); float y3 = y1 - 0.4f * Units.Centimeters * e.ScaleY; if ((Parent as LinearGauge).Inverted) { y3 = y2 - g.MeasureString(text, Font).Height + 0.4f * Units.Centimeters * e.ScaleY; } for (int i = 0; i < majorTicksNum; i++) { g.DrawLine(pen, x, y1, x, y2); SizeF strSize = g.MeasureString(text, Font); g.DrawString(text, font, brush, x - strSize.Width / 2 * e.ScaleX, y3); text = Convert.ToString(textStep * (i + 1) + Parent.Minimum); x += step; } brush.Dispose(); }
/// <inheritdoc/> public override bool Equals(object obj) { HighlightCondition c = obj as HighlightCondition; return(c != null && Expression == c.Expression && Border.Equals(c.Border) && Fill.Equals(c.Fill) && TextFill.Equals(c.TextFill) && Font.Equals(c.Font) && Visible == c.Visible && ApplyBorder == c.ApplyBorder && ApplyFill == c.ApplyFill && ApplyTextFill == c.ApplyTextFill && ApplyFont == c.ApplyFont); }
/// <summary> /// Determines if two cells have identical settings. /// </summary> /// <param name="cell">Cell to compare with.</param> /// <returns><b>true</b> if cells are equal.</returns> public bool Equals(TableCell cell) { // do not override exising Equals method. It is used to compare elements in a list, // and will cause problems in the designer. return(cell != null && Fill.Equals(cell.Fill) && TextFill.Equals(cell.TextFill) && HorzAlign == cell.HorzAlign && VertAlign == cell.VertAlign && Border.Equals(cell.Border) && Font.Equals(cell.Font) && Formats.Equals(cell.Formats) && Highlight.Equals(cell.Highlight) && Restrictions == cell.Restrictions && Hyperlink.Equals(cell.Hyperlink) && Padding == cell.Padding && AllowExpressions == cell.AllowExpressions && Brackets == cell.Brackets && HideZeros == cell.HideZeros && HideValue == cell.HideValue && Angle == cell.Angle && RightToLeft == cell.RightToLeft && WordWrap == cell.WordWrap && Underlines == cell.Underlines && Trimming == cell.Trimming && FontWidthRatio == cell.FontWidthRatio && FirstTabOffset == cell.FirstTabOffset && ParagraphOffset == cell.ParagraphOffset && TabWidth == cell.TabWidth && Clip == cell.Clip && Wysiwyg == cell.Wysiwyg && LineHeight == cell.LineHeight && Style == cell.Style && EvenStyle == cell.EvenStyle && HoverStyle == cell.HoverStyle && HasHtmlTags == cell.HasHtmlTags && NullValue == cell.NullValue && ProcessAt == cell.ProcessAt && Printable == cell.Printable && Exportable == cell.Exportable && CellDuplicates == cell.CellDuplicates && // events BeforePrintEvent == cell.BeforePrintEvent && AfterPrintEvent == cell.AfterPrintEvent && AfterDataEvent == cell.AfterDataEvent && Cursor == cell.Cursor && ClickEvent == cell.ClickEvent && MouseDownEvent == cell.MouseDownEvent && MouseMoveEvent == cell.MouseMoveEvent && MouseUpEvent == cell.MouseUpEvent && MouseEnterEvent == cell.MouseEnterEvent && MouseLeaveEvent == cell.MouseLeaveEvent ); }
private void DrawMajorTicksVert(FRPaintEventArgs e) { IGraphics g = e.Graphics; Pen pen = e.Cache.GetPen(MajorTicks.Color, MajorTicks.Width * e.ScaleY, 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); pointerWidthOffset = (Parent.Pointer as SimplePointer).Width / 2 + Parent.Pointer.BorderWidth * 2 * e.ScaleX; float y = top + height; float x1 = left; float x2 = left + width / 2 - pointerWidthOffset; float x3 = left + width / 2 + pointerWidthOffset; float x4 = left + width; float step = height / (majorTicksNum - 1); int textStep = (int)((Parent.Maximum - Parent.Minimum) / (majorTicksNum - 1)); Font font = e.Cache.GetFont(Font.Name, Parent.IsPrinting ? Font.Size : Font.Size * e.ScaleX * 96f / DrawUtils.ScreenDpi, Font.Style); string text = Parent.Minimum.ToString(); if (firstSubScale.Enabled) { for (int i = 0; i < majorTicksNum; i++) { g.DrawLine(pen, x1, y, x2, y); if (firstSubScale.ShowCaption) { SizeF strSize = g.MeasureString(text, Font); g.DrawString(text, font, brush, x1 - strSize.Width * e.ScaleX / (DrawUtils.ScreenDpi / 96f) - 0.04f * Units.Centimeters * e.ScaleX, y - strSize.Height / 2 * e.ScaleY / (DrawUtils.ScreenDpi / 96f)); text = Convert.ToString(textStep * (i + 1) + Parent.Minimum); } y -= step; } } y = top + height; text = Parent.Minimum.ToString(); if (secondSubScale.Enabled) { for (int i = 0; i < majorTicksNum; i++) { g.DrawLine(pen, x3, y, x4, y); if (secondSubScale.ShowCaption) { SizeF strSize = g.MeasureString(text, Font); g.DrawString(text, font, brush, x4 + 0.04f * Units.Centimeters * e.ScaleX, y - strSize.Height / 2 * e.ScaleY / (DrawUtils.ScreenDpi / 96f)); text = Convert.ToString(textStep * (i + 1) + Parent.Minimum); } y -= step; } } brush.Dispose(); }
private void DrawMajorTicksHorz(FRPaintEventArgs e) { 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, Parent.AbsTop, Parent.Width, Parent.Height), e.ScaleX, e.ScaleY); pointerHeightOffset = (Parent.Pointer as SimplePointer).Height / 2 + Parent.Pointer.BorderWidth * 2 * e.ScaleY; float x = left; float y1 = top; float y2 = top + height / 2 - pointerHeightOffset; float y3 = top + height / 2 + pointerHeightOffset; float y4 = top + height; float step = width / (majorTicksNum - 1); int textStep = (int)((Parent.Maximum - Parent.Minimum) / (majorTicksNum - 1)); Font font = e.Cache.GetFont(Font.Name, Parent.IsPrinting ? Font.Size : Font.Size * e.ScaleX * 96f / DrawUtils.ScreenDpi, Font.Style); string text = Parent.Minimum.ToString(); if (firstSubScale.Enabled) { for (int i = 0; i < majorTicksNum; i++) { g.DrawLine(pen, x, y1, x, y2); if (firstSubScale.ShowCaption) { SizeF strSize = g.MeasureString(text, Font); g.DrawString(text, font, brush, x - strSize.Width / 2 * e.ScaleX / (DrawUtils.ScreenDpi / 96f), y1 - 0.4f * Units.Centimeters * e.ScaleY); text = Convert.ToString(textStep * (i + 1) + Parent.Minimum); } x += step; } } x = left; text = Parent.Minimum.ToString(); if (secondSubScale.Enabled) { for (int i = 0; i < majorTicksNum; i++) { g.DrawLine(pen, x, y3, x, y4); if (secondSubScale.ShowCaption) { SizeF strSize = g.MeasureString(text, Font); g.DrawString(text, font, brush, x - strSize.Width / 2 * e.ScaleX / (DrawUtils.ScreenDpi / 96f), y4 + 0.08f * Units.Centimeters * e.ScaleY); text = Convert.ToString(textStep * (i + 1) + Parent.Minimum); } x += step; } } brush.Dispose(); }
/// <summary> /// Serializes the watermark. /// </summary> /// <param name="writer">Writer object.</param> /// <param name="prefix">The watermark property name.</param> /// <param name="c">Another Watermark object to compare with.</param> /// <remarks> /// This method is for internal use only. /// </remarks> public void Serialize(FRWriter writer, string prefix, Watermark c) { if (Enabled != c.Enabled) { writer.WriteBool(prefix + ".Enabled", Enabled); } if (!writer.AreEqual(Image, c.Image)) { writer.WriteValue(prefix + ".Image", Image); } if (ImageSize != c.ImageSize) { writer.WriteValue(prefix + ".ImageSize", ImageSize); } if (ImageTransparency != c.ImageTransparency) { writer.WriteFloat(prefix + ".ImageTransparency", ImageTransparency); } if (Text != c.Text) { writer.WriteStr(prefix + ".Text", Text); } if ((writer.SerializeTo != SerializeTo.Preview || !writer.AreEqual(Font, c.Font)) && writer.ItemName != "inherited") { writer.WriteValue(prefix + ".Font", Font); } TextFill.Serialize(writer, prefix + ".TextFill", c.TextFill); if (TextRotation != c.TextRotation) { writer.WriteValue(prefix + ".TextRotation", TextRotation); } if (ShowTextOnTop != c.ShowTextOnTop) { writer.WriteBool(prefix + ".ShowTextOnTop", ShowTextOnTop); } if (ShowImageOnTop != c.ShowImageOnTop) { writer.WriteBool(prefix + ".ShowImageOnTop", ShowImageOnTop); } }
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; Graphics 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; } }
// use the TableObject to represent the contents. It's easier to export it later. private TableObject GetTable(bool autoRows) { TableObject table = new TableObject(); table.SetPrinting(IsPrinting); table.SetReport(Report); float cellWidth = CellWidth; float cellHeight = CellHeight; // calculate cellWidth, cellHeight automatically if (cellWidth == 0 || cellHeight == 0) { float fontHeight = Font.GetHeight() * 96f / DrawUtils.ScreenDpi; cellWidth = (int)Math.Round((fontHeight + 10) / Page.SnapSize.Width) * Page.SnapSize.Width; cellHeight = cellWidth; } int colCount = (int)((Width + HorzSpacing + 1) / (cellWidth + HorzSpacing)); if (colCount == 0) { colCount = 1; } int rowCount = (int)((Height + VertSpacing + 1) / (cellHeight + VertSpacing)); if (rowCount == 0 || autoRows) { rowCount = 1; } table.ColumnCount = colCount; table.RowCount = rowCount; // process the text int row = 0; int lineBegin = 0; int lastSpace = 0; string text = Text.Replace("\r\n", "\n"); for (int i = 0; i < text.Length; i++) { bool isCRLF = text[i] == '\n'; if (text[i] == ' ' || isCRLF) { lastSpace = i; } if (i - lineBegin + 1 > colCount || isCRLF) { if (WordWrap && lastSpace > lineBegin) { AddText(table, row, text.Substring(lineBegin, lastSpace - lineBegin)); lineBegin = lastSpace + 1; } else if (i - lineBegin > 0) { AddText(table, row, text.Substring(lineBegin, i - lineBegin)); lineBegin = i; } else { lineBegin = i + 1; } lastSpace = lineBegin; row++; if (autoRows && row >= rowCount) { rowCount++; table.RowCount++; } } } // finish the last line if (lineBegin < text.Length) { AddText(table, row, text.Substring(lineBegin, text.Length - lineBegin)); } // set up cells appearance for (int i = 0; i < colCount; i++) { for (int j = 0; j < rowCount; j++) { TableCell cell = table[i, j]; cell.Border = Border.Clone(); cell.Fill = Fill.Clone(); cell.Font = Font; cell.TextFill = TextFill.Clone(); cell.HorzAlign = HorzAlign.Center; cell.VertAlign = VertAlign.Center; } } // set cell's width and height for (int i = 0; i < colCount; i++) { table.Columns[i].Width = cellWidth; } for (int i = 0; i < rowCount; i++) { table.Rows[i].Height = cellHeight; } // insert spacing between cells if (HorzSpacing > 0) { for (int i = 0; i < colCount - 1; i++) { TableColumn newColumn = new TableColumn(); newColumn.Width = HorzSpacing; table.Columns.Insert(i * 2 + 1, newColumn); } } if (VertSpacing > 0) { for (int i = 0; i < rowCount - 1; i++) { TableRow newRow = new TableRow(); newRow.Height = VertSpacing; table.Rows.Insert(i * 2 + 1, newRow); } } table.Left = AbsLeft; table.Top = AbsTop; table.Width = table.Columns[table.ColumnCount - 1].Right; table.Height = table.Rows[table.RowCount - 1].Bottom; return(table); }
/// <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); }
/// <inheritdoc/> public override void Serialize(FRWriter writer) { if (writer.SerializeTo == SerializeTo.Preview && AutoWidth) { WordWrap = false; float width = CalcSize().Width; if ((Anchor & AnchorStyles.Right) != 0) { Left = Right - width; } Width = width; } TextObject c = writer.DiffObject as TextObject; base.Serialize(writer); if (AutoWidth != c.AutoWidth) { writer.WriteBool("AutoWidth", AutoWidth); } if (AutoShrink != c.AutoShrink) { writer.WriteValue("AutoShrink", AutoShrink); } if (FloatDiff(AutoShrinkMinSize, c.AutoShrinkMinSize)) { writer.WriteFloat("AutoShrinkMinSize", AutoShrinkMinSize); } if (HorzAlign != c.HorzAlign) { writer.WriteValue("HorzAlign", HorzAlign); } if (VertAlign != c.VertAlign) { writer.WriteValue("VertAlign", VertAlign); } if (Angle != c.Angle) { writer.WriteInt("Angle", Angle); } if (RightToLeft != c.RightToLeft) { writer.WriteBool("RightToLeft", RightToLeft); } if (WordWrap != c.WordWrap) { writer.WriteBool("WordWrap", WordWrap); } if (Underlines != c.Underlines) { writer.WriteBool("Underlines", Underlines); } if (!Font.Equals(c.Font)) { writer.WriteValue("Font", Font); } TextFill.Serialize(writer, "TextFill", c.TextFill); if (Trimming != c.Trimming) { writer.WriteValue("Trimming", Trimming); } if (FontWidthRatio != c.FontWidthRatio) { writer.WriteFloat("FontWidthRatio", FontWidthRatio); } if (FirstTabOffset != c.FirstTabOffset) { writer.WriteFloat("FirstTabOffset", FirstTabOffset); } if (TabWidth != c.TabWidth) { writer.WriteFloat("TabWidth", TabWidth); } if (Clip != c.Clip) { writer.WriteBool("Clip", Clip); } if (Wysiwyg != c.Wysiwyg) { writer.WriteBool("Wysiwyg", Wysiwyg); } if (LineHeight != c.LineHeight) { writer.WriteFloat("LineHeight", LineHeight); } if (HtmlTags != c.HtmlTags) { writer.WriteBool("HtmlTags", HtmlTags); } if (ForceJustify != c.ForceJustify) { writer.WriteBool("ForceJustify", ForceJustify); } if (writer.SerializeTo != SerializeTo.Preview) { if (Style != c.Style) { writer.WriteStr("Style", Style); } if (Highlight.Count > 0) { writer.Write(Highlight); } } }