0

Alright, I have a TImage set up inside a TScrollBox. The TScrollBox has Scrollbars enabled to move the TImage around and when the '+' or '-' Buttons are clicked I need the TImage to Scale up and down, as well as the Scrollbars accordingly.

UI Setup:

Community
  • 1
  • 1
Janrich
  • 55
  • 1
  • 6
  • If you wan to zoom in and out of the image, then clearly you can't set AutoSize to true (which automatically sizes the image to fit into the size of the timage component, and would eliminate your ability to change the image size yourself). – Ken White Jul 20 '18 at 20:35
  • This example uses a TrackBar to zoom, I need to use buttons therefore it is not a duplicate – Janrich Jul 20 '18 at 20:35
  • The UI component you use to control it is irrelevant. Use + to mean *move the trackbar right* and the - to mean *move the trackbar left*. The logic is the same, you just have to keep track of the values yourself instead of letting the trackbar do it for you. It's still *zooming an image in a scrollbox*. *How do I add integers a and b in Delphi* is the same question as *How do I add integers x and y in Delphi*; they're not different just because the variable names are not the same. – Ken White Jul 20 '18 at 20:36
  • Alright, but is there a simple/straight forward function or method I can use to scale a TImage?? – Janrich Jul 20 '18 at 20:40
  • 1
    Programming isn't about copying and pasting sample code. It's about understanding how code works, and making it work to fit your needs. Don't expect there to be a sample fitting your precise needs, and don't expect anyone to write it for you either. – Jerry Dodge Jul 20 '18 at 20:41
  • 1
    That's in the code in the linked post. That's the function or method you can use to scale an image. TImage is simply a container for that image. TImage doesn't *scale or zoom*. It displays content. You can turn off AutoSize and turn on Stretch, and then change the width and height of the TImage, but it's going to turn the image into an unusable mess with very little change in size. – Ken White Jul 20 '18 at 20:41

0 Answers0