0

I'm using C++ Builder XE6 and TScrollBox. Inside the ScrollBox component I have a huge picture (TImage). The ScrollBox shows vertical and horizontal scrollbars but I would like to be able to "grab and drag" the image with left mouse button in order to move to different areas of the image. When I say "grab and drag" I mean to have the same effect as moving the horizontal and vertical scrollbars of the TScrollBox component. How do I do that?

NGLN
  • 41,953
  • 8
  • 104
  • 194
Tracer
  • 2,462
  • 2
  • 21
  • 53
  • Change the mouse cursor to drag when the button is pressed and set a flag which is cleared when the button is released. Track mouse movement as long as the flag exists. Scroll accordingly. – Sertac Akyuz May 19 '16 at 17:51
  • By "TScrollBar", do you really mean "TScrollBox"? You can't put child controls in a `TScrollBar`. – Remy Lebeau May 19 '16 at 21:26
  • [This is your answer](http://stackoverflow.com/a/9503002/757830). – NGLN May 19 '16 at 21:38

0 Answers0