Enum GradientFillType

GradientFillType enumeration

Represents all Gradient fill type.

public enum GradientFillType

Values

NameValueDescription
Linear0Linear
Radial1Radial
Rectangle2Rectangle
Path3Path

Examples

using System;
using Aspose.Cells;
using Aspose.Cells.Drawing;
using System.Drawing;

namespace AsposeCellsExamples
{
    public class DrawingClassGradientFillTypeDemo
    {
        public static void Run()
        {
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            // Create a shape to demonstrate gradient fill
            Shape shape = worksheet.Shapes.AddRectangle(1, 0, 1, 5, 5, 20);

            // Get the fill format
            FillFormat fillFormat = shape.Fill;

            // Set gradient fill type and properties
            fillFormat.SetTwoColorGradient(System.Drawing.Color.Blue, System.Drawing.Color.LightBlue, GradientStyleType.Horizontal, 1);
            fillFormat.GradientFill.SetGradient(GradientFillType.Linear, 45, GradientDirectionType.FromUpperLeftCorner);

            // Output gradient direction type
            Console.WriteLine("Gradient Direction Type: " + fillFormat.GradientFill.DirectionType);

            // Save the workbook
            workbook.Save("GradientFillTypeDemo.xlsx");
        }
    }
}

See Also