ShapeComplexFill.FillRect Property
Gets or set the direction of a gradient fill and specifies the fill area of a picture fill.
Namespace: DevExpress.Spreadsheet.Drawings
Assembly: DevExpress.Spreadsheet.v24.2.Core.dll
NuGet Package: DevExpress.Spreadsheet.Core
Declaration
Property Value
Type | Description |
---|---|
ShapeRectangleOffset | A ShapeRectangleOffset object that specifies the offset from the corresponding edge of the shape’s bounding box. |
Remarks
Picture Fill Settings
When image stretching is specified (the ShapePictureFill.Stretch property is set to true), you can use the FillRect property to define a part of the chart element to which the picture fill should be applied. In this case, the picture will be scaled to fit the specified fill area. For example, a bottom offset of 25% specifies that the bottom edge of the picture is located above the shape’s bottom edge by an amount equal to 25% of the shape’s width.
The table below demonstrates how the FillRect property works for the ShapePictureFill object (the chart is displayed in Microsoft® Excel®).
FillRect is not specified | FillRect.Bottom = 0.25 |
---|---|
To specify the part of the picture used for the fill, utilize the ShapePictureFill.SourceRect property.
Gradient Fill Settings
Use the FillRect property to specify the gradient direction, which depends on the gradient type applied to the chart element (ShapeGradientFill.GradientType). The FillRect property defines the focus rectangle for the center shade relative to the fill rectangle. Each edge of the center shade rectangle is defined by an offset from the corresponding edge of the fill rectangle. For example, a left offset of 25% (FillRect.Left = 0.25) specifies, that the center shade occupies the 75% of the fill area. Therefore, the gradient fills the remaining leftmost 25% of the region.
The image below demonstrates the chart with the radial gradient direction From Center (the chart is displayed in Microsoft® Excel®). The center shade rectangle defined by the FillRect property is a single point in the center of the chart. This creates the effect of color progression from the center with the focus at the central point of the fill area.
To specify the part of the chart element to which the gradient should be applied, use the ShapeGradientFill.TileRect property.
Note
The FillRect
property has no effect on the visual appearance of a chart when the document is loaded in the SpreadsheetControl. However, the property can be accessed in code, exported in supported formats and visualized in Microsoft Excel.
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.
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;