0

I have a WinForms app, which has a large panel, which I am drawing on to. Basically, I implemented a scrollbar mechanism, which can imitate a zoom behavior on my drawing. Now I want to do something more.

I thought about adding a possibility to not zoom my drawing if it doesn't fit on the panel, but just use a scroll (vertical or horizontal) to see the full picture. So it looks like this:

Zoom is set to 1: (drawing is too big, there are supposed to be 4 circles)

enter image description here

I zoom back, and there they are, but really, really small:

enter image description here

And I want to have a possibility to just scroll the panel (f.e. in this situation horizontally), to see the whole drawing without having to shrink those drawings.

P.S I searched through SO, and I only found answers suggesting using PictureBox instead of Panel and I'm not sure I want to do that

minecraftplayer1234
  • 2,127
  • 4
  • 27
  • 57
  • out of fags... this question is a dupe of https://stackoverflow.com/questions/6090558/add-vertical-scroll-bar-to-panel – Technivorous Oct 24 '18 at 15:03
  • When I do this, I get 3 scrollbars (f.e. I want it to be horizontal, then I get 2 normal ones, and one more horizontal, which is above the usual one). And those two outer work, but they don't offer scrolling beyond the panel, and the other one offers that, but it doesn't move the panel – minecraftplayer1234 Oct 24 '18 at 15:14
  • it wont move the pane until something exceeds it – Technivorous Oct 24 '18 at 15:17
  • And I draw something that actually does exceed it – minecraftplayer1234 Oct 24 '18 at 15:32
  • If you don't want to use the standard ScrollBars, use another `TrackBar`. You can set the `Maximum` to the difference between the *Canvas* (the `[Panel].Width`) and the *Viewport* (the `[Form].Width`). On the `[TrackBar].Scroll()` event, set the `[Panel].Left = - [TrackBar].Value`. Of course, you can do the same for the Y dimension, with another `TrackBar` (or a custom `ScrollBar`). – Jimi Oct 25 '18 at 02:04
  • You may to have a look at [this](https://stackoverflow.com/questions/26396876/best-way-to-make-images-scrollable-that-where-painted-on-the-control/26423184?s=2|32.2787#26423184) and [this](https://stackoverflow.com/questions/44079331/resizing-drawlines-on-a-paint-event/44088560#44088560) – TaW Oct 25 '18 at 07:49

0 Answers0