Page 1 of 1

Text size dynamically

Posted: Mon Mar 12, 2012 4:39 am
by Rodrigo
Hi all.

I have a problem to set the size of a rectangle dynamically.

I have a text "Text10" and a Data Source I get the size of the text box for each record to paint.

I tried setting the value of the text: {this.Text10.ClientRectangle = new Stimulsoft.Base.Drawing.RectangleD (7.4, 0.1, DataSource.SizeText, 0.5)}

The report paints the first text to default size in the design. The second text is painted with the size of the first. The third with the size of the second.

Do you understand?

example:
My Data Source with 3 records.
1. 6
2. 8
3. 2

What the report shows:

1. | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (default text size in design, 10.6)
2. | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (6)
3. | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (8)

So I show 3 records, but as the first is bad, all others are displayed wrong.

Can you help me?

Text size dynamically

Posted: Tue Mar 13, 2012 2:45 am
by HighAley
Hello.
Rodrigo wrote:I have a problem to set the size of a rectangle dynamically.

I have a text "Text10" and a Data Source I get the size of the text box for each record to paint.

I tried setting the value of the text: {this.Text10.ClientRectangle = new Stimulsoft.Base.Drawing.RectangleD (7.4, 0.1, DataSource.SizeText, 0.5)}

The report paints the first text to default size in the design. The second text is painted with the size of the first. The third with the size of the second.

Do you understand?

example:
My Data Source with 3 records.
1. 6
2. 8
3. 2

What the report shows:

1. | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (default text size in design, 10.6)
2. | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (6)
3. | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (8)

So I show 3 records, but as the first is bad, all others are displayed wrong.

Can you help me?
Please, try to use your expression in the Before Print event.

If you still have any problem, send us your report template with data.

Thank you.

Text size dynamically

Posted: Tue Mar 13, 2012 4:01 am
by Rodrigo
I tried setting the expression "new Stimulsoft.Base.Drawing.RectangleD (7.4, 0.1, DataSource.SizeText, 0.5)" in the code view, but when I save the changes, updates itself and returns to "new Stimulsoft. Base.Drawing.RectangleD (7.4, 0.1, 10.6, 0.5) "

Thanks for answering.

Text size dynamically

Posted: Wed Mar 14, 2012 2:42 am
by HighAley
Rodrigo wrote:I tried setting the expression "new Stimulsoft.Base.Drawing.RectangleD (7.4, 0.1, DataSource.SizeText, 0.5)" in the code view, but when I save the changes, updates itself and returns to "new Stimulsoft. Base.Drawing.RectangleD (7.4, 0.1, 10.6, 0.5) "

Thanks for answering.
This code in in the region with message:

Code: Select all

 #region StiReport Designer generated code - do not modify
It mean that you shouldn't modify it.

In next video you could find out when to change Events How to Add Event Handler to Component

Thank you.