Back to Devexpress

XRShape.FillColor Property

xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xrshape-4186c643.md

latest6.5 KB
Original Source

XRShape.FillColor Property

Gets or sets the color to fill the shape’s contents.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
[SRCategory(ReportStringId.CatAppearance)]
[Browsable(true)]
public Color FillColor { get; set; }
vb
<SRCategory(ReportStringId.CatAppearance)>
<Browsable(True)>
Public Property FillColor As Color

Property Value

TypeDescription
Color

A Color object which represents the fill color of a shape.

|

Example

This example demonstrates how to create the XRShape Arrow type control, and set its basic properties.

Tip

Online Example : How to insert a shape control into a report

csharp
using System;
using System.Drawing;
using System.Windows.Forms;
using DevExpress.XtraReports.UI;
using DevExpress.XtraPrinting.Shape;
//...

private void button1_Click(object sender, EventArgs e) {
    XtraReport1 report = new XtraReport1();

    // Create a shape control.
    XRShape shape = new XRShape();

    // Set the shape's type to Arrow.
    shape.Shape = new ShapeArrow();

    // Adjust the Arrow shape's main properties.
    shape.Angle = 90;
    shape.Width = 200;
    shape.Height = 200;
    shape.ForeColor = Color.Brown;
    shape.FillColor = Color.Beige;
    shape.Stretch = false;

    // Adjust the Arrow shape's specific properties.
    ((ShapeArrow)shape.Shape).ArrowHeight = 50;
    ((ShapeArrow)shape.Shape).ArrowWidth = 50;
    ((ShapeArrow)shape.Shape).Fillet = 20;

    // Preview the report.
    report.Detail.Controls.Add(shape);
    ReportPrintTool pt = new ReportPrintTool(report);
    pt.ShowPreviewDialog();
}
vb
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports DevExpress.XtraReports.UI
Imports DevExpress.XtraPrinting.Shape
'...

Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) _
Handles button1.Click
    Dim report As New XtraReport1()

    ' Create a shape control.
    Dim shape As New XRShape()

    ' Set the shape's type to Arrow.
    shape.Shape = New ShapeArrow()

    ' Adjust the Arrow shape's main properties.
    shape.Angle = 90
    shape.Width = 200
    shape.Height = 200
    shape.ForeColor = Color.Brown
    shape.FillColor = Color.Beige
    shape.Stretch = False

    ' Adjust the Arrow shape's specific properties.
    CType(shape.Shape, ShapeArrow).ArrowHeight = 50
    CType(shape.Shape, ShapeArrow).ArrowWidth = 50
    CType(shape.Shape, ShapeArrow).Fillet = 20

    ' Preview the report.
    report.Detail.Controls.Add(shape)
    Dim pt As New ReportPrintTool(report)
    pt.ShowPreviewDialog()
End Sub

The following code snippets (auto-collected from DevExpress Examples) contain references to the FillColor property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

reporting-winforms-insert-a-shape-control/CS/Form1.cs#L28

csharp
shape.ForeColor = Color.Brown;
shape.FillColor = Color.Beige;
shape.Stretch = false;

asp-net-mvc-grid-create-report-based-on-grid-layout/CS/E4755/Controllers/HomeController.cs#L59

csharp
if (Convert.ToBoolean(((XRShape) sender).Report.GetCurrentColumnValue("Discontinued")) == true)
    ((XRShape) sender).FillColor = Color.Yellow;
else

asp-net-web-forms-grid-create-report-based-on-grid-layout/CS/WebApplication1/Default.aspx.cs#L42

csharp
if(Convert.ToBoolean(((XRShape)sender).Report.GetCurrentColumnValue("Discontinued")) == true)
    ((XRShape)sender).FillColor = Color.Yellow;
else

reporting-winforms-insert-a-shape-control/VB/Form1.vb#L28

vb
shape.ForeColor = Color.Brown
shape.FillColor = Color.Beige
shape.Stretch = False

asp-net-mvc-grid-create-report-based-on-grid-layout/VB/E4755/Controllers/HomeController.vb#L58

vb
If Convert.ToBoolean((CType(sender, XRShape)).Report.GetCurrentColumnValue("Discontinued")) = True Then
    CType(sender, XRShape).FillColor = Color.Yellow
Else

asp-net-web-forms-grid-create-report-based-on-grid-layout/VB/WebApplication1/Default.aspx.vb#L47

vb
If Convert.ToBoolean(DirectCast(sender, XRShape).Report.GetCurrentColumnValue("Discontinued")) = True Then
    DirectCast(sender, XRShape).FillColor = Color.Yellow
Else

See Also

BackColor

ForeColor

XRShape Class

XRShape Members

DevExpress.XtraReports.UI Namespace