本文档阐述了如何把 箭头 类型的形状控件插入到报表中。 另外还简要说明了它的属性。 要学习更多关于 XtraReports 中的形状的内容,请参阅 形状概述 文档。
简要说明
箭头 类型的形状的外观如下图所示的那样。
形状的属性
应设置下列属性,来指定特定的 箭头 类型:
- ShapeArrow.ArrowHeight - 此属性用于指定箭头的相对高度 (百分比)。 返回值介于 0 到 100 之间。
- ShapeArrow.ArrowWidth - 此属性用于指定箭头的相对宽度 (百分比)。 返回值介于 0 到 100 之间。
- FilletShapeBase.Fillet - 此属性用于指定箭头的相对圆度 (百分比)。 返回值介于 0 到 100 之间。
示例
这个示例展示了如何创建一个 XRShape 箭头 类型的控件,并设置它的基本属性。
Show Me |
---|
在 DevExpress Code Central 数据库中可以找到完整的示例项目,网址是 http://www.devexpress.com/example=E160。 取决于目标平台类型 (ASP.NET、WinForms 等),可以在线运行本示例,或者下载自动可执行的示例。 |
C# | 复制代码 |
---|---|
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); report.ShowPreview(); } |
Visual Basic | 复制代码 |
---|---|
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) report.ShowPreview() End Sub |