xtrareports-devexpress-dot-xtrareports-dot-ui-f1de42c9.md
A control that allows you to embed simple graphic elements into a report.
Namespace : DevExpress.XtraReports.UI
Assembly : DevExpress.XtraReports.v25.2.dll
NuGet Package : DevExpress.Reporting.Core
public class XRShape :
XRControl,
IXtraSupportCreateContentPropertyValue
Public Class XRShape
Inherits XRControl
Implements IXtraSupportCreateContentPropertyValue
Drag the XRShape control from the DX.25.2: Report Controls Toolbox tab and drop it onto the report to add a shape.
Expand the control’s smart tag to access its main settings.
The following sections describe the available shape types in detail.
The following properties are specific to the Arrow shape type:
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
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();
}
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 properties are specific to the Brace shape type:
This example demonstrates how to create the XRShape Brace type control, and set its basic properties.
Tip
Online Example : How to insert a shape control into a report
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 Brace.
shape.Shape = new ShapeBrace();
// Adjust the Brace shape's main properties.
shape.Angle = 180;
shape.Width = 200;
shape.Height = 200;
shape.ForeColor = Color.Brown;
shape.Stretch = false;
// Adjust the Brace shape's specific properties.
((ShapeBrace)shape.Shape).TipLength = 20;
((ShapeBrace)shape.Shape).TailLength = 20;
((ShapeBrace)shape.Shape).Fillet = 50;
// Preview the report.
report.Detail.Controls.Add(shape);
ReportPrintTool pt = new ReportPrintTool(report);
pt.ShowPreviewDialog();
}
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 Brace.
shape.Shape = New ShapeBrace()
' Adjust the Brace shape's main properties.
shape.Angle = 180
shape.Width = 200
shape.Height = 200
shape.ForeColor = Color.Brown
shape.Stretch = False
' Adjust the Brace shape's specific properties.
CType(shape.Shape, ShapeBrace).TipLength = 20
CType(shape.Shape, ShapeBrace).TailLength = 20
CType(shape.Shape, ShapeBrace).Fillet = 50
' Preview the report.
report.Detail.Controls.Add(shape)
Dim pt As New ReportPrintTool(report)
pt.ShowPreviewDialog()
End Sub
The following properties are specific to the Bracket shape type:
This example demonstrates how to create the XRShape Bracket type control, and set its basic properties.
Tip
Online Example : How to insert a shape control into a report
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 Bracket.
shape.Shape = new ShapeBracket();
// Adjust the Bracket shape's main properties.
shape.Angle = 180;
shape.Width = 200;
shape.Height = 200;
shape.ForeColor = Color.Brown;
shape.Stretch = false;
// Adjust the Bracket shape's specific properties.
((ShapeBracket)shape.Shape).TipLength = 20;
// Preview the report.
report.Detail.Controls.Add(shape);
ReportPrintTool pt = new ReportPrintTool(report);
pt.ShowPreviewDialog();
}
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 Bracket.
shape.Shape = New ShapeBracket()
' Adjust the Bracket shape's main properties.
shape.Angle = 180
shape.Width = 200
shape.Height = 200
shape.ForeColor = Color.Brown
shape.Stretch = False
' Adjust the Bracket shape's specific properties.
CType(shape.Shape, ShapeBracket).TipLength = 20
' Preview the report.
report.Detail.Controls.Add(shape)
Dim pt As New ReportPrintTool(report)
pt.ShowPreviewDialog()
End Sub
The following properties are specific to the Cross shape type:
This example demonstrates how to create the XRShape Cross type control, and set its basic properties.
Tip
Online Example : How to insert a shape control into a report
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 Cross.
shape.Shape = new ShapeCross();
// Adjust the Cross 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 Cross shape's specific properties.
((ShapeCross)shape.Shape).HorizontalLineWidth = 50;
((ShapeCross)shape.Shape).VerticalLineWidth = 50;
((ShapeCross)shape.Shape).Fillet = 20;
// Preview the report.
report.Detail.Controls.Add(shape);
ReportPrintTool pt = new ReportPrintTool(report);
pt.ShowPreviewDialog();
}
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 Cross.
shape.Shape = New ShapeCross()
' Adjust the Cross 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 Cross shape's specific properties.
CType(shape.Shape, ShapeCross).HorizontalLineWidth = 50
CType(shape.Shape, ShapeCross).VerticalLineWidth = 50
CType(shape.Shape, ShapeCross).Fillet = 20
' Preview the report.
report.Detail.Controls.Add(shape)
Dim pt As New ReportPrintTool(report)
pt.ShowPreviewDialog()
End Sub
This example demonstrates how to create the XRShape Ellipse type control, and set its basic properties.
Tip
Online Example : How to insert a shape control into a report
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 Ellipse.
shape.Shape = new ShapeEllipse();
// Adjust the Ellipse shape's main properties.
shape.Angle = 90;
shape.Width = 200;
shape.Height = 200;
shape.ForeColor = Color.Brown;
shape.FillColor = Color.Beige;
shape.Stretch = false;
// Preview the report.
report.Detail.Controls.Add(shape);
ReportPrintTool pt = new ReportPrintTool(report);
pt.ShowPreviewDialog();
}
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 Ellipse.
shape.Shape = New ShapeEllipse()
' Adjust the Ellipse shape's main properties.
shape.Angle = 90
shape.Width = 200
shape.Height = 200
shape.ForeColor = Color.Brown
shape.FillColor = Color.Beige
shape.Stretch = False
' Preview the report.
report.Detail.Controls.Add(shape)
Dim pt As New ReportPrintTool(report)
pt.ShowPreviewDialog()
End Sub
This example demonstrates how to create the XRShape Line type control, and set its basic properties.
Tip
Online Example : How to insert a shape control into a report
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 Line.
shape.Shape = new ShapeLine();
// Adjust the Line shape's main properties.
shape.Angle = 45;
shape.Width = 200;
shape.Height = 200;
shape.ForeColor = Color.Brown;
shape.Stretch = false;
// Preview the report.
report.Detail.Controls.Add(shape);
ReportPrintTool pt = new ReportPrintTool(report);
pt.ShowPreviewDialog();
}
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 Line.
shape.Shape = New ShapeLine()
' Adjust the Line shape's main properties.
shape.Angle = 45
shape.Width = 200
shape.Height = 200
shape.ForeColor = Color.Brown
shape.Stretch = False
' Preview the report.
report.Detail.Controls.Add(shape)
Dim pt As New ReportPrintTool(report)
pt.ShowPreviewDialog()
End Sub
The following properties are specific to the Polygon shape type:
This example demonstrates how to create the XRShape Polygon type control, and set its basic properties.
Tip
Online Example : How to insert a shape control into a report
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 Polygon.
shape.Shape = new ShapePolygon();
// Adjust the Polygon 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 Polygon shape's specific properties.
((ShapePolygon)shape.Shape).NumberOfSides = 7;
((ShapePolygon)shape.Shape).Fillet = 5;
// Preview the report.
report.Detail.Controls.Add(shape);
ReportPrintTool pt = new ReportPrintTool(report);
pt.ShowPreviewDialog();
}
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 Polygon.
shape.Shape = New ShapePolygon()
' Adjust the Polygon 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 Polygon shape's specific properties.
CType(shape.Shape, ShapePolygon).NumberOfSides = 7
CType(shape.Shape, ShapePolygon).Fillet = 5
' Preview the report.
report.Detail.Controls.Add(shape)
Dim pt As New ReportPrintTool(report)
pt.ShowPreviewDialog()
End Sub
The following properties are specific to the Rectangle shape type:
This example demonstrates how to create the XRShape Rectangle type control, and set its basic properties.
Tip
Online Example : How to insert a shape control into a report
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 Rectangle.
shape.Shape = new ShapeRectangle();
// Adjust the Rectangle 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 Rectangle shape's specific properties.
((ShapeRectangle)shape.Shape).Fillet = 20;
// Preview the report.
report.Detail.Controls.Add(shape);
ReportPrintTool pt = new ReportPrintTool(report);
pt.ShowPreviewDialog();
}
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 Rectangle.
shape.Shape = New ShapeRectangle()
' Adjust the Rectangle 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 Rectangle shape's specific properties.
CType(shape.Shape, ShapeRectangle).Fillet = 20
' Preview the report.
report.Detail.Controls.Add(shape)
Dim pt As New ReportPrintTool(report)
pt.ShowPreviewDialog()
End Sub
The following properties are specific to the Star shape type:
This example demonstrates how to create the XRShape Star type control, and set its basic properties.
Tip
Online Example : How to insert a shape control into a report
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 Star.
shape.Shape = new ShapeStar();
// Adjust the Star 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 Star shape's specific properties.
((ShapeStar)shape.Shape).Concavity = 50;
((ShapeStar)shape.Shape).StarPointCount = 7;
((ShapeStar)shape.Shape).Fillet = 5;
// Preview the report.
report.Detail.Controls.Add(shape);
ReportPrintTool pt = new ReportPrintTool(report);
pt.ShowPreviewDialog();
}
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 Star.
shape.Shape = New ShapeStar()
' Adjust the Star 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 Star shape's specific properties.
CType(shape.Shape, ShapeStar).Concavity = 50
CType(shape.Shape, ShapeStar).StarPointCount = 7
CType(shape.Shape, ShapeStar).Fillet = 5
' Preview the report.
report.Detail.Controls.Add(shape)
Dim pt As New ReportPrintTool(report)
pt.ShowPreviewDialog()
End Sub
Object MarshalByRefObject Component XRControl XRShape
See Also