79409617

Date: 2025-02-03 18:01:31
Score: 2
Natty:
Report link

This is happening because you have Proportional property set to true.

What Proportional property does is it shrinks the image in order to fit the control while maintaining the aspect ration. But if the size of TImage is larger than the dimensions of the picture the picture never gets stretched in order to fit the TImage control.

And since picture position within TImage control is always aligned to top left corner and you are changing the position of your TImage control it seems as the image starts moving in left and up direction.


How to solve this? Instead of setting Proportional property to True set the Stretch property to True.

However you will need to make sure that you adjust the Width and Height of your TImage in order to maintain aspect ratio of the loaded picture. After that your code will work just nicely.

How do you do this? Check the FormCreate event method in the SO answer you got your code from.

Reasons:
  • Blacklisted phrase (1): How do you
  • Blacklisted phrase (1): How to solve
  • RegEx Blacklisted phrase (1.5): How to solve this?
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • High reputation (-1):
Posted by: SilverWarior