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

Adjust panel height to fit to its content

3 Answers 516 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sachin
Top achievements
Rank 1
Sachin asked on 21 Dec 2011, 08:01 PM
Hi,

I am working on a report where I have some textboxes inside a panel. The height of panel should decrease if some of those textboxes are not visible. As per your suggestion in another forum, I have set the height of the panel to minimum right after InitializeComponent() so it will grow to fit its content. It is working but report is inserting white space equal to panel's original height after it displays the panel. I have attached the image of report template. The panel is in green color. As you can see there is white space between panel and the next blue colored textbox which is outside the panel.

3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 23 Dec 2011, 01:57 PM
Hello,

If in the report definition, the blue textbox is let's say 1 inch away from the panel, then this space would be preserved at all times and this is expected. The suggestion you have read applies to a slightly different scenario. 
If in the designer both items (textbox and panel) are right next to each other, then you can apply the same suggestion to the detail section height as you did with the panel height. See Design Considerations for Report Item Layout for more info.

All the best,
Steve
the Telerik team

Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

0
Sachin
Top achievements
Rank 1
answered on 23 Dec 2011, 03:21 PM
Hi Steve,

There is no space between panel and the blue textbox. They are right next to each other. I have attached the designer view.
0
Elian
Telerik team
answered on 27 Dec 2011, 04:53 PM
Hello,

There is no space in the designer, but you create it after the InitializeComponent() with code which is the same thing. If you don't know how much exactly the panel will shrink, you can set anchoring to the second panel (so it would be on a constant distance from the first). See automatic layout for more info. 
However if you know how much the panel will shrink you can move the second panel up.

Kind regards,
Elian
the Telerik team

Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

Tags
General Discussions
Asked by
Sachin
Top achievements
Rank 1
Answers by
Steve
Telerik team
Sachin
Top achievements
Rank 1
Elian
Telerik team
Share this question
or