/// <summary>
        /// Creates the collection of <see cref="IPrinterViewMargin"/> objects to place within a <see cref="IPrinterView"/>.
        /// </summary>
        /// <param name="view">The <see cref="IPrinterView"/> that will host the margins.</param>
        /// <returns>A <see cref="IPrinterViewMarginCollection"/> containing the <see cref="IPrinterViewMargin"/> objects that were created.</returns>
        public IPrinterViewMarginCollection CreateMargins(IPrinterView view)
        {
            IPrinterViewMarginCollection margins = new PrinterViewMarginCollection();

            margins.Add(new CustomMargin(view));
            return(margins);
        }
Beispiel #2
0
        /// <summary>
        /// Initializes an instance of the <c>CustomMargin</c> class.
        /// </summary>
        /// <param name="view">The <see cref="IPrinterView"/> that will host the margins.</param>
        /// <param name="placement">A <see cref="PrinterViewMarginPlacement"/> indicating the placement of the margin within its parent <see cref="IPrinterView"/>.</param>
        public CustomMargin(IPrinterView view, PrinterViewMarginPlacement placement) : this()
        {
            this.Placement = placement;

            // Get the style manually from the resources above the SyntaxEditor since this margin will be used
            //   outside the resource scope of the SyntaxEditor when displayed in a print preview...
            //   Alternatively, define a global style for this type in the application resources
            this.Style = view.SyntaxEditor.FindResource(typeof(CustomMargin)) as Style;
        }
Beispiel #3
0
        /// <summary>
        /// Initializes an instance of the <c>CustomMargin</c> class.
        /// </summary>
        /// <param name="view">The <see cref="IPrinterView"/> that will host the margin.</param>
        public CustomMargin(IPrinterView view)
        {
            // Store the document title
            this.DocumentTitle = view.SyntaxEditor.PrintSettings.DocumentTitle;

            // Get the style manually from the resources above the SyntaxEditor since this margin will be used
            //   outside the resource scope of the SyntaxEditor when displayed in a print preview...
            //   Alternatively, define a global style for this type in the application resources
            this.Style = view.SyntaxEditor.FindResource(typeof(CustomMargin)) as Style;
        }
Beispiel #4
0
        /// <summary>
        /// Creates the collection of <see cref="IPrinterViewMargin"/> objects to place within a <see cref="IPrinterView"/>.
        /// </summary>
        /// <param name="view">The <see cref="IPrinterView"/> that will host the margins.</param>
        /// <returns>A <see cref="IPrinterViewMarginCollection"/> containing the <see cref="IPrinterViewMargin"/> objects that were created.</returns>
        public IPrinterViewMarginCollection CreateMargins(IPrinterView view)
        {
            IPrinterViewMarginCollection margins = new PrinterViewMarginCollection();

            // Add four margins
            margins.Add(new CustomMargin(view, PrinterViewMarginPlacement.Left));
            margins.Add(new CustomMargin(view, PrinterViewMarginPlacement.Top));
            margins.Add(new CustomMargin(view, PrinterViewMarginPlacement.Right));
            margins.Add(new CustomMargin(view, PrinterViewMarginPlacement.Bottom));

            return(margins);
        }