When setting margins for a component they are set globally

Stimulsoft Reports.NET discussion
Post Reply
ACIV
Posts: 26
Joined: Mon Jan 27, 2014 5:20 pm

When setting margins for a component they are set globally

Post by ACIV »

Hello there,

For some reason, whenever I set the margins of a component in code it sets them for all other components with margins - e.g.

Code: Select all

pageDescription.Margins.Top = 8;
This piece of code alone will set the top margin to 8 for alll other components. Can you please rectify this
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Re: When setting margins for a component they are set global

Post by Jan »

Hello,

This strange behavior depends on the place of your code in which you change report components margins. Maybe you do this after report rendering. If yes, then you need to try to use following code instead your:

Code: Select all

pageDescription.Margins = new StiMargins(0, 1, 2, 3);
Why do you need to create a new margins object? Report engine during report rendering use StiMargins object from report template (it does not create a copy of this object). This behavior decrease memory consumption and increase the speed of report rendering (this method is used for different properties).

Please contact us if you need any help.

Thank you.
Post Reply