Back to Devexpress

ShapeComplexFill Interface

officefileapi-devexpress-dot-spreadsheet-dot-drawings-a8a96d05.md

latest5.7 KB
Original Source

ShapeComplexFill Interface

Serves as a base for the ShapeGradientFill and ShapePictureFill interfaces and contains specific settings for the gradient and picture fills.

Namespace : DevExpress.Spreadsheet.Drawings

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
public interface ShapeComplexFill
vb
Public Interface ShapeComplexFill

Remarks

The ShapeComplexFill object’s properties enable you to set specific characteristics for the gradient and picture fills. In particular, you can determine whether the fill should be rotated with the shape (ShapeComplexFill.RotateWithShape), specify how to flip the gradient or picture while tiling (ShapeComplexFill.FlipType), set the direction of the gradient and define the fill region for the picture fill (ShapeComplexFill.FillRect).

Example

The following example demonstrates how to create a scatter chart with straight lines and markers and customize its appearance by applying the complex gradient to the chart background. Set the gradient fill by calling the ShapeOutlineFill.SetGradientFill method, and then specify the gradient direction From Center by utilizing the ShapeComplexFill.FillRect property.

View Example

csharp
Worksheet worksheet = workbook.Worksheets["chartScatter"];
workbook.Worksheets.ActiveWorksheet = worksheet;

// Create a chart and specify its location.
Chart chart = worksheet.Charts.Add(ChartType.ScatterLineMarkers, worksheet["C2:D52"]);
chart.TopLeftCell = worksheet.Cells["F2"];
chart.BottomRightCell = worksheet.Cells["L17"];

// Set the series line color.
chart.Series[0].Outline.SetSolidFill(Color.FromArgb(0xBC, 0xCF, 0x02));

// Specify the data markers.
Marker markerOptions = chart.Series[0].Marker;
markerOptions.Symbol = MarkerStyle.Diamond;
markerOptions.Size = 10;
markerOptions.Fill.SetSolidFill(Color.FromArgb(0xBC, 0xCF, 0x02));
markerOptions.Outline.SetNoFill();

// Set no fill for the plot area.
chart.PlotArea.Fill.SetNoFill();

// Apply the gradient fill to the chart area.
chart.Fill.SetGradientFill(ShapeGradientType.Circle, Color.FromArgb(0xE3, 0x48, 0x03), Color.FromArgb(0x00, 0x32, 0x86));
ShapeGradientFill gradientFill = chart.Fill.GradientFill;
gradientFill.FillRect.Left = 0.5;
gradientFill.FillRect.Right = 0.5;
gradientFill.FillRect.Bottom = 0.5;
gradientFill.FillRect.Top = 0.5;

// Set the X-axis scale.
Axis axisX = chart.PrimaryAxes[0];
axisX.Scaling.AutoMax = false;
axisX.Scaling.AutoMin = false;
axisX.Scaling.Max = 60.0;
axisX.Scaling.Min = -60.0;
axisX.MajorGridlines.Visible = true;
axisX.Visible = false;

// Set the Y-axis scale.
Axis axisY = chart.PrimaryAxes[1];
axisY.Scaling.AutoMax = false;
axisY.Scaling.AutoMin = false;
axisY.Scaling.Max = 50.0;
axisY.Scaling.Min = -50.0;
axisY.MajorUnit = 10.0;
axisY.Visible = false;

// Hide the chart legend.
chart.Legend.Visible = false;
vb
Dim worksheet As Worksheet = workbook.Worksheets("chartScatter")
workbook.Worksheets.ActiveWorksheet = worksheet

' Create a chart and specify its location.
Dim chart As Chart = worksheet.Charts.Add(ChartType.ScatterLineMarkers, worksheet("C2:D52"))
chart.TopLeftCell = worksheet.Cells("F2")
chart.BottomRightCell = worksheet.Cells("L17")

' Set the series line color.
chart.Series(0).Outline.SetSolidFill(Color.FromArgb(&HBC, &HCF, &H2))

' Specify the data markers.
Dim markerOptions As Marker = chart.Series(0).Marker
markerOptions.Symbol = MarkerStyle.Diamond
markerOptions.Size = 10
markerOptions.Fill.SetSolidFill(Color.FromArgb(&HBC, &HCF, &H2))
markerOptions.Outline.SetNoFill()

' Set no fill for the plot area.
chart.PlotArea.Fill.SetNoFill()

' Apply the gradient fill to the chart area.
chart.Fill.SetGradientFill(ShapeGradientType.Circle, Color.FromArgb(&HE3, &H48, &H3), Color.FromArgb(&H0, &H32, &H86))
Dim gradientFill As ShapeGradientFill = chart.Fill.GradientFill
gradientFill.FillRect.Left = 0.5
gradientFill.FillRect.Right = 0.5
gradientFill.FillRect.Bottom = 0.5
gradientFill.FillRect.Top = 0.5

' Set the X-axis scale.
Dim axisX As Axis = chart.PrimaryAxes(0)
axisX.Scaling.AutoMax = False
axisX.Scaling.AutoMin = False
axisX.Scaling.Max = 60.0
axisX.Scaling.Min = -60.0
axisX.MajorGridlines.Visible = True
axisX.Visible = False

' Set the Y-axis scale.
Dim axisY As Axis = chart.PrimaryAxes(1)
axisY.Scaling.AutoMax = False
axisY.Scaling.AutoMin = False
axisY.Scaling.Max = 50.0
axisY.Scaling.Min = -50.0
axisY.MajorUnit = 10.0
axisY.Visible = False

' Hide the chart legend.
chart.Legend.Visible = False

See Also

ShapeComplexFill Members

DevExpress.Spreadsheet.Drawings Namespace