This is a migrated thread and some comments may be shown as answers.

Add Rectangle programmatically

1 Answer 151 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jeremy
Top achievements
Rank 1
Jeremy asked on 27 Apr 2016, 05:12 AM

Hi

 

How do I insert a 600 x 241 rectangle into a report header programmatically?

I've tried:

var myReport = new Report();
var header = new ReportHeaderSection();
header.Items.Add(new Shape
{
    ShapeType = new PolygonShape(4, 45, 0) { Bounds = RectangleF.FromLTRB(0, 225, 600, 466) },
    Size = new SizeU(Unit.Pixel(600), Unit.Pixel(241)),
    Location = new PointU(Unit.Pixel(0), Unit.Pixel(225)),
    Style = { Color = Color.DarkGray, LineWidth = Unit.Pixel(1) }
});
myReport.Items.Add(header);

But all I get is a square. Why isn't it expanding to a rectangle?

I've also tried using an ellipse (and got a circle funnily enough). The output doesn't change if I leave out the Bounds either.

1 Answer, 1 is accepted

Sort by
0
Jeremy
Top achievements
Rank 1
answered on 28 Apr 2016, 06:28 AM

Finally worked it out!

Had to add:

Stretch = true;

Tags
General Discussions
Asked by
Jeremy
Top achievements
Rank 1
Answers by
Jeremy
Top achievements
Rank 1
Share this question
or