Consume white space in PictureBox

1 Answer 28 Views
PictureBox Report Designer (standalone)
Steve
Top achievements
Rank 1
Steve asked on 18 May 2021, 06:46 PM

I have a report with a PictureBox control in it. The report could have multiple images of various sizes and because some of these images could be larger than the actual page width, i use the ScaleProportional setting with the container of the picturebox taking up the entire page. This way the image will take up as much of the page as necessary without exceeding. 

The issue is that we also have some images that are smaller, and when the report prints, it retains all the whitespace defined by the picturebox container. Is there any way to configure my report so that the smaller images do not retain all this white space?

The images are fed into the report using a url on our file server passed into the PictureBox bindings so I don't have access to the actual dimensions of the image

1 Answer, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 21 May 2021, 02:17 PM

Hello Steve,

Indeed, when you use ScaleProportional, the image Height/Width will be matched so that the Height matches with the PictureBox Height or the Width matches with the PictureBox Width. In order to keep the image proportions, the other size may remain smaller compared with the corresponding PictureBox size.

If I understood correctly, you would like to keep the image in proportions, so the Stretch option doesn't work for you.

The other option is to set the PictureBox Size with Bindings. However, you need to know the size of the incoming image. You may utilize a custom User Function that takes as an argument the image, and sets the PictureBox Size based on the size extracted by the user function from the passed image.

Regards,
Todor
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Steve
Top achievements
Rank 1
commented on 25 May 2021, 01:20 PM

Thank you Todor - I was able to get the functionality I was looking for in my standalone Report Designer, however now I would like to be able to have the functionality work in our companies web client. Since there is no Telerik.config file for the web service, I assume the reference to the built assembly needs to be placed in the web.config file but if i copy and paste the below code from the telerik config file into the web config file in causes a 500 internal service error

<Telerik.Reporting>
<AssemblyReferences>
<add name="ensurCustomizations" version="4.6.0.0" culture="neutral" publicKeyToken="null" />
</AssemblyReferences>
</Telerik.Reporting>
Todor
Telerik team
commented on 25 May 2021, 01:31 PM

You need to register the Telerik.Reporting config section in the configSections element on the web.config file:

<configuration>
<configSections>
<section
name="Telerik.Reporting"
type="Telerik.Reporting.Configuration.ReportingConfigurationSection, Telerik.Reporting"
allowLocation="true"
allowDefinition="Everywhere"/>
</configSections>
...

 

and reference the assembly with the User Function in the project hosting the Reporting engine, for example, the REST Service project.

Steve
Top achievements
Rank 1
commented on 25 May 2021, 02:52 PM

Thanks for the quick response! Adding the section name to the configSections element resolved the 500 internal service error. Unfortunately the report is still not picking up the assembly. I am assuming your last comment about referencing the assembly in the project hosting the Reporting engine is the solution for that, however I am not familiar with that side of Development. Are you saying the reference does not go in the web.config file but in the project code itself? Just trying to make sure I understand so I can communicate it properly with our Dev team.

Thanks in Advance!
Todor
Telerik team
commented on 28 May 2021, 10:02 AM

The assembly 'ensurCustomizations' would be looked for by the Reporting engine with the System.Reflection functionality. Hence, it should be available for the project that hosts the Reporting engine. If I understood correctly, it gets found successfully by the Standalone Designer. That's why I assume that it DLL is copied in the designer's folder.

For the web project, you need to make sure the hosted Reporting engine will find the same DLL. For that reason, you need to copy it along with the other needed assemblies. For example, you may reference the 'ensurCustomizations' assembly in the project that hosts the Reporting engine. It should be included in the Project References/Dependencies - see Manage references in a project.

Tags
PictureBox Report Designer (standalone)
Asked by
Steve
Top achievements
Rank 1
Answers by
Todor
Telerik team
Share this question
or