Add Rectangle programmatically

2 posts, 0 answers
  1. Jeremy
    Jeremy avatar
    9 posts
    Member since:
    Apr 2016

    Posted 27 Apr Link to this post

    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.

  2. Jeremy
    Jeremy avatar
    9 posts
    Member since:
    Apr 2016

    Posted 28 Apr in reply to Jeremy Link to this post

    Finally worked it out!

    Had to add:

    Stretch = true;

  3. DevCraft banner
Back to Top