Reports for WinForms includes support for shadows cast by render objects. The public IShadow interface is implemented by a public structure Shadow, and exposed by a non-ambient public property Shadow.
It includes the following sub-properties:
Property | Description |
---|---|
Transparency | Gets or sets the transparency of the shadow, in percent. A value of 0 defines a solid (non-transparent) shadow, a value of 100 (which is the default) defines a fully transparent (invisible) shadow. |
Size | Gets or sets the size of the shadow relative to the size of the object, in percent. A value of 100 (which is the default) indicates that the shadow has the same size as the object. |
Distance | Gets or sets the distance that the shadow's center is offset from the the object's center. Note that only absolute Unit values (such as "0.5in" or "4mm") can be assigned to this property. The default is 2mm. |
Angle | Gets or sets the angle, in degrees, of the shadow. The angle is measured relative to the three o'clock position clockwise. The default is 45. |
Color | Gets or sets the color of the shadow. The default is Black. |
The following sample code defines a shadow on a render object:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim doc As C1PrintDocument = C1PrintDocument1 Dim rt As New RenderText("Sample Shadow") rt.Width = Unit.Auto rt.Style.Shadow.Transparency = 20 rt.Style.Shadow.Color = Color.BurlyWood doc.Body.Children.Add(rt) |
To write code in C#
C# |
Copy Code
|
---|---|
C1PrintDocument doc = c1PrintDocument1; RenderText rt = new RenderText("Sample Shadow"); rt.Width = Unit.Auto; rt.Style.Shadow.Transparency = 20; rt.Style.Shadow.Color = Color.BurlyWood; doc.Body.Children.Add(rt); |
Note that while you do not need to create a Shadow object when setting shadow properties, you may choose to do so, for example, like this:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim doc As C1PrintDocument = C1PrintDocument1 Dim rt As New RenderText("Sample Shadow") rt.Width = Unit.Auto rt.Style.Shadow = New Shadow(20, 100, "1mm", 45, Color.CadetBlue) doc.Body.Children.Add(rt) |
To write code in C#
C# |
Copy Code
|
---|---|
C1PrintDocument doc = c1PrintDocument1; RenderText rt = new RenderText("Sample Shadow"); rt.Width = Unit.Auto; rt.Style.Shadow = new Shadow(20, 100, "1mm", 45, Color.CadetBlue); doc.Body.Children.Add(rt); |