menu

WinForms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Enum PdfLinearGradientMode - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Enum PdfLinearGradientMode

    Specifies the gradient direction of the linear gradient brush.

    Namespace: Syncfusion.Pdf.Graphics
    Assembly: Syncfusion.Pdf.Base.dll
    Syntax
    public enum PdfLinearGradientMode
    Examples
    //Create a new PDF document.
    PdfDocument doc = new PdfDocument();
    //Add a page to the document.
    PdfPage page = doc.Pages.Add();
    //Create PDF graphics for the page
    PdfGraphics graphics = page.Graphics;
    //Create new PDF gradient brush.  
     PdfLinearGradientBrush brush = new PdfLinearGradientBrush(new RectangleF(0, 0,200, 100), new PdfColor(Color.Red), new PdfColor(Color.Blue), PdfLinearGradientMode.Vertical);
    //Draw rectangle.
    graphics.DrawRectangle(brush, new RectangleF(0, 0, 200, 100));           
    //Save the document.
    doc.Save("Output.pdf");
    //Close the document.
    doc.Close(true);
    'Create a new PDF document.
    Dim doc As New PdfDocument()
    'Add a page to the document.
    Dim page As PdfPage = doc.Pages.Add()
    'Create PDF graphics for the page
    Dim graphics As PdfGraphics = page.Graphics
    'Create new PDF gradient brush.           
    Dim brush As New PdfLinearGradientBrush(New RectangleF(0, 0, 200, 100), New PdfColor(Color.Red), New PdfColor(Color.Blue), PdfLinearGradientMode.Vertical)
    'Draw rectangle.
    graphics.DrawRectangle(brush, New RectangleF(0, 0, 200, 100))
    'Save the document.
    doc.Save("Output.pdf")
    'Close the document.
    doc.Close(True)

    Fields

    Name Description
    BackwardDiagonal

    Specifies a gradient from upper right to lower left.

    ForwardDiagonal

    Specifies a gradient from upper left to lower right.

    Horizontal

    Specifies a gradient from left to right.

    Vertical

    Specifies a gradient from top to bottom.

    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved