VintaSoft Imaging .NET SDK 14.0: Документация для .NET разработчика
Vintasoft.Imaging.Pdf.Tree.Patterns Namespace / TilingPattern Class
Члены типа Объект Синтаксис Example Иерархия Требования Смотрите также
В этом разделе
    Класс TilingPattern
    В этом разделе
    Представляет шаблон мозаики, состоящий из небольшой графической фигуры, называемой ячейкой шаблона.
    Объектная модель
    PdfResources AffineMatrix PdfDocument PdfIndirectReference PdfBasicObject TilingPattern
    Синтаксис
    'Declaration
    
    Public Class TilingPattern
       Inherits PdfGraphicalPattern
    
    
    public class TilingPattern : PdfGraphicalPattern
    
    
    public __gc class TilingPattern : public PdfGraphicalPattern*
    
    
    public ref class TilingPattern : public PdfGraphicalPattern^
    
    
    Пример

    Вот пример, показывающий, как заполнить прямоугольник и эллипс с помощью шаблона мозаики на PDF странице:

    
    ''' <summary>
    ''' Fill recctangle and ellipse use tiling pattern.
    ''' </summary>
    ''' <param name="pdfFilename">The PDF filename.</param>
    Public Shared Sub TilingPatternExample(pdfFilename As String)
        ' create new PDF document
        Using document As New Vintasoft.Imaging.Pdf.PdfDocument(pdfFilename, Vintasoft.Imaging.Pdf.PdfFormat.Pdf_16)
            ' add empty page (A4 size)
            Dim page As Vintasoft.Imaging.Pdf.Tree.PdfPage = document.Pages.Add(Vintasoft.Imaging.PaperSizeKind.A4)
    
            ' create Tiling Pattern
            Dim pattern As New Vintasoft.Imaging.Pdf.Tree.Patterns.TilingPattern(page.Document, 10, 15)
            Using g As Vintasoft.Imaging.Pdf.Drawing.PdfGraphics = pattern.GetGraphics()
                Dim pen As New Vintasoft.Imaging.Pdf.Drawing.PdfPen(System.Drawing.Color.Blue)
                Dim brush As New Vintasoft.Imaging.Pdf.Drawing.PdfBrush(System.Drawing.Color.LightGreen)
                g.FillAndDrawEllipse(pen, brush, pattern.BoundingBox)
            End Using
    
            ' get PdfGraphics for PDF page
            Using g As Vintasoft.Imaging.Pdf.Drawing.PdfGraphics = page.GetGraphics()
                ' create red pen
                Dim pen As New Vintasoft.Imaging.Pdf.Drawing.PdfPen(System.Drawing.Color.Red)
    
                ' create brush to fill use Tiling Pattern
                Dim brush As New Vintasoft.Imaging.Pdf.Drawing.PdfBrush(pattern)
    
                ' fill rectangle use Tiling Pattern
                g.FillAndDrawRectangle(pen, brush, New System.Drawing.RectangleF(50, 100, 100, 200))
                ' fill ellipse use Tiling Pattern
                g.FillAndDrawEllipse(pen, brush, New System.Drawing.RectangleF(100, 200, 200, 300))
            End Using
    
            ' save changes in PDF document
            document.SaveChanges()
        End Using
    End Sub
    
    
    
    /// <summary>
    /// Fill recctangle and ellipse use tiling pattern.
    /// </summary>
    /// <param name="pdfFilename">The PDF filename.</param>
    public static void TilingPatternExample(string pdfFilename)
    {
        // create new PDF document
        using (Vintasoft.Imaging.Pdf.PdfDocument document =
            new Vintasoft.Imaging.Pdf.PdfDocument(pdfFilename, Vintasoft.Imaging.Pdf.PdfFormat.Pdf_16))
        {
            // add empty page (A4 size)
            Vintasoft.Imaging.Pdf.Tree.PdfPage page = document.Pages.Add(
                Vintasoft.Imaging.PaperSizeKind.A4);
    
            // create Tiling Pattern
            Vintasoft.Imaging.Pdf.Tree.Patterns.TilingPattern pattern =
                new Vintasoft.Imaging.Pdf.Tree.Patterns.TilingPattern(page.Document, 10, 15);
            using (Vintasoft.Imaging.Pdf.Drawing.PdfGraphics g = pattern.GetGraphics())
            {
                Vintasoft.Imaging.Pdf.Drawing.PdfPen pen =
                    new Vintasoft.Imaging.Pdf.Drawing.PdfPen(System.Drawing.Color.Blue);
                Vintasoft.Imaging.Pdf.Drawing.PdfBrush brush =
                    new Vintasoft.Imaging.Pdf.Drawing.PdfBrush(System.Drawing.Color.LightGreen);
                g.FillAndDrawEllipse(pen, brush, pattern.BoundingBox);
            }
    
            // get PdfGraphics for PDF page
            using (Vintasoft.Imaging.Pdf.Drawing.PdfGraphics g = page.GetGraphics())
            {
                // create red pen
                Vintasoft.Imaging.Pdf.Drawing.PdfPen pen =
                    new Vintasoft.Imaging.Pdf.Drawing.PdfPen(System.Drawing.Color.Red);
    
                // create brush to fill use Tiling Pattern
                Vintasoft.Imaging.Pdf.Drawing.PdfBrush brush =
                    new Vintasoft.Imaging.Pdf.Drawing.PdfBrush(pattern);
    
                // fill rectangle use Tiling Pattern
                g.FillAndDrawRectangle(pen, brush, new System.Drawing.RectangleF(50, 100, 100, 200));
                // fill ellipse use Tiling Pattern
                g.FillAndDrawEllipse(pen, brush, new System.Drawing.RectangleF(100, 200, 200, 300));
            }
    
            // save changes in PDF document
            document.SaveChanges();
        }
    }
    
    

    Иерархия наследования

    System.Object
       Vintasoft.Imaging.Pdf.Tree.PdfTreeNodeBase
          Vintasoft.Imaging.Pdf.Tree.Patterns.PdfGraphicalPattern
             Vintasoft.Imaging.Pdf.Tree.Patterns.TilingPattern

    Требования

    Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    Смотрите также