Skip to Content
Former Member
Jul 22, 2007 at 10:32 AM

Maintaining aspect ratio


Post Author: QRedIT

CA Forum: General


I'm having trouble maintaining the aspect ratio of images in my reports. Please let me explain what I am trying to do.I am using VB.Net 2005 to create reports with CR XI Developer Edition, using RDC. These reports contain BlobFieldObject objects that are bound to binary fields in a database containing the image data. Databases can be MS Access, MySQL or MS SQL. So far so good: the images are printed in the report.However, the images in the report are fixed size, while the size of the images in the database may vary.Given a certain width in the report I want the height of the BlobFieldObject to adjust accordingly, maintaining the original aspect ratio of the image. This is the part that gives me trouble. I have been playing around with the XScaling and YScaling properties of the object, but no luck.E.g. let's say the database contains an image with a size of 250x100 pixels (wxh).If I define the width of the BlobFieldObject to (let's say) 500 twips the height of the object is determined by the original size and shows at (let's say) 900 twips. This is clearly an incorrect aspect ratio.If I set the YScaling property equal to XScaling the picture will show at 500 twips x 500 twips. Incorrect aspect ratio as well.

So how can I achieve that the size of the object will be 500x200 twips for this image? And the image of the next database record having a size of 400x240 pixels shows in the report as 500x300 twips?

I hope I have described my problem clearly enough.