/// <summary> /// Assigns values from another source. /// </summary> /// <param name="source">Source to assign from.</param> public void Assign(Watermark source) { Enabled = source.Enabled; Image = source.Image == null ? null : source.Image.Clone() as Image; ImageSize = source.ImageSize; ImageTransparency = source.ImageTransparency; Text = source.Text; Font = source.Font; TextFill = source.TextFill.Clone(); TextRotation = source.TextRotation; ShowTextOnTop = source.ShowTextOnTop; ShowImageOnTop = source.ShowImageOnTop; }
/// <inheritdoc/> protected override void Dispose(bool disposing) { if (disposing) { if (Subreport != null) { Subreport.ReportPage = null; } if (Watermark != null) { Watermark.Dispose(); Watermark = null; } } base.Dispose(disposing); }
/// <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); } }
/// <inheritdoc/> public override void Assign(Base source) { base.Assign(source); ReportPage src = source as ReportPage; ExportAlias = src.ExportAlias; Landscape = src.Landscape; PaperWidth = src.PaperWidth; PaperHeight = src.PaperHeight; RawPaperSize = src.RawPaperSize; LeftMargin = src.LeftMargin; TopMargin = src.TopMargin; RightMargin = src.RightMargin; BottomMargin = src.BottomMargin; MirrorMargins = src.MirrorMargins; AssignPreview(src); Columns.Assign(src.Columns); Guides.Assign(src.Guides); Border = src.Border.Clone(); Fill = src.Fill.Clone(); Watermark.Assign(src.Watermark); TitleBeforeHeader = src.TitleBeforeHeader; OutlineExpression = src.OutlineExpression; PrintOnPreviousPage = src.PrintOnPreviousPage; ResetPageNumber = src.ResetPageNumber; ExtraDesignWidth = src.ExtraDesignWidth; BackPage = src.BackPage; StartOnOddPage = src.StartOnOddPage; StartPageEvent = src.StartPageEvent; FinishPageEvent = src.FinishPageEvent; ManualBuildEvent = src.ManualBuildEvent; UnlimitedHeight = src.UnlimitedHeight; PrintOnRollPaper = src.PrintOnRollPaper; UnlimitedWidth = src.UnlimitedWidth; UnlimitedHeightValue = src.UnlimitedHeightValue; UnlimitedWidthValue = src.UnlimitedWidthValue; }
/// <summary> /// Initializes a new instance of the <see cref="ReportPage"/> class with default settings. /// </summary> public ReportPage() { FPaperWidth = 210; FPaperHeight = 297; FLeftMargin = 10; FTopMargin = 10; FRightMargin = 10; FBottomMargin = 10; FFirstPageSource = 7; FOtherPagesSource = 7; FDuplex = Duplex.Default; FBands = new BandCollection(this); FGuides = new FloatCollection(); FColumns = new PageColumns(this); FBorder = new Border(); FFill = new SolidFill(SystemColors.Window); FWatermark = new Watermark(); FTitleBeforeHeader = true; FStartPageEvent = ""; FFinishPageEvent = ""; FManualBuildEvent = ""; BaseName = "Page"; }
/// <inheritdoc/> public override void Serialize(FRWriter writer) { ReportPage c = writer.DiffObject as ReportPage; base.Serialize(writer); if (ExportAlias != c.ExportAlias) { writer.WriteStr("ExportAlias", ExportAlias); } if (Landscape != c.Landscape) { writer.WriteBool("Landscape", Landscape); } if (FloatDiff(PaperWidth, c.PaperWidth)) { writer.WriteFloat("PaperWidth", PaperWidth); } if (FloatDiff(PaperHeight, c.PaperHeight)) { writer.WriteFloat("PaperHeight", PaperHeight); } if (RawPaperSize != c.RawPaperSize) { writer.WriteInt("RawPaperSize", RawPaperSize); } if (FloatDiff(LeftMargin, c.LeftMargin)) { writer.WriteFloat("LeftMargin", LeftMargin); } if (FloatDiff(TopMargin, c.TopMargin)) { writer.WriteFloat("TopMargin", TopMargin); } if (FloatDiff(RightMargin, c.RightMargin)) { writer.WriteFloat("RightMargin", RightMargin); } if (FloatDiff(BottomMargin, c.BottomMargin)) { writer.WriteFloat("BottomMargin", BottomMargin); } if (MirrorMargins != c.MirrorMargins) { writer.WriteBool("MirrorMargins", MirrorMargins); } WritePreview(writer, c); Columns.Serialize(writer, c.Columns); if (Guides.Count > 0) { writer.WriteValue("Guides", Guides); } Border.Serialize(writer, "Border", c.Border); Fill.Serialize(writer, "Fill", c.Fill); Watermark.Serialize(writer, "Watermark", c.Watermark); if (TitleBeforeHeader != c.TitleBeforeHeader) { writer.WriteBool("TitleBeforeHeader", TitleBeforeHeader); } if (OutlineExpression != c.OutlineExpression) { writer.WriteStr("OutlineExpression", OutlineExpression); } if (PrintOnPreviousPage != c.PrintOnPreviousPage) { writer.WriteBool("PrintOnPreviousPage", PrintOnPreviousPage); } if (ResetPageNumber != c.ResetPageNumber) { writer.WriteBool("ResetPageNumber", ResetPageNumber); } if (ExtraDesignWidth != c.ExtraDesignWidth) { writer.WriteBool("ExtraDesignWidth", ExtraDesignWidth); } if (StartOnOddPage != c.StartOnOddPage) { writer.WriteBool("StartOnOddPage", StartOnOddPage); } if (BackPage != c.BackPage) { writer.WriteBool("BackPage", BackPage); } if (StartPageEvent != c.StartPageEvent) { writer.WriteStr("StartPageEvent", StartPageEvent); } if (FinishPageEvent != c.FinishPageEvent) { writer.WriteStr("FinishPageEvent", FinishPageEvent); } if (ManualBuildEvent != c.ManualBuildEvent) { writer.WriteStr("ManualBuildEvent", ManualBuildEvent); } if (UnlimitedHeight != c.UnlimitedHeight) { writer.WriteBool("UnlimitedHeight", UnlimitedHeight); } if (PrintOnRollPaper != c.PrintOnRollPaper) { writer.WriteBool("PrintOnRollPaper", PrintOnRollPaper); } if (UnlimitedWidth != c.UnlimitedWidth) { writer.WriteBool("UnlimitedWidth", UnlimitedWidth); } if (FloatDiff(UnlimitedHeightValue, c.UnlimitedHeightValue)) { writer.WriteFloat("UnlimitedHeightValue", UnlimitedHeightValue); } if (FloatDiff(UnlimitedWidthValue, c.UnlimitedWidthValue)) { writer.WriteFloat("UnlimitedWidthValue", UnlimitedWidthValue); } }
/// <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 !MONO if (!obj.IsVisible(e)) { continue; } #endif } 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); } } }
/// <summary> /// Creates exact copy of this <b>Watermark</b>. /// </summary> /// <returns>Copy of this watermark.</returns> public Watermark Clone() { Watermark result = new Watermark(); result.Assign(this); return result; }