Selecting different sizes of Images and resize the TDBImage based on Imagesize
Posted on 2004-11-20
I have a TDBImage on my form.
When I want to add an image to it I manage that with:
procedure TForm1.ILogoClick(Sender: TObject);
if OpenPictureDialog1.Execute then
Property Stretch = True
So far so good, but then I see how the image is shown on screen.
When the image doesn't have relatively the same dimensions the image isn't correctly displayed.
1. This is what I want to do:
Select an image as shown above. Then the dimensions of the TDBImage must be adjusted to the relative size of the loaded image-file.
Note: The TDBImage must have a maximum size. (otherwise my whole screen will be coverred with the image).
TDBImage.Height = 100 (=also maximum height)
TDBImage.width = 100 (=also maximum width)
Loading an image of : Image file size = 200 x 400 pixels
In order to display the image correctly (stretched) - Based on the image-sizes, the TDBImage must be resized to:
TDBImage.Height = 50
TDBImage.width = 100
This way I don't need to have demands regarding imagesizes that can be loaded into the program, and still display them well.
2. Set a maximum imagesize for the loaded image. Purely for storage purposes (afterall it is stored in a database).
3. The image can be a BMP, WMF, JPEG or JPG.
If this complicates it a lot than limit these to JGP and BMP (or even only one of them)
Please supply me with some working sample as I don't have any knowledge regarding images.
Thanks for your help.