Text size dynamically

Stimulsoft Reports.WEB discussion
Post Reply
Rodrigo
Posts: 15
Joined: Mon Jun 14, 2010 5:00 am

Text size dynamically

Post 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?
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Text size dynamically

Post 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.
Rodrigo
Posts: 15
Joined: Mon Jun 14, 2010 5:00 am

Text size dynamically

Post 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.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Text size dynamically

Post 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.
Post Reply