3

How can I apply a horizontal scroll bar to a Panel?

I'm working on 2d tiled map editor and I'm using a Panel to hold the contents. When my map is bigger than my panel it just goes off and becomes invisible, would it be possible to apply custom scroll bars?

Oliver
  • 43,366
  • 8
  • 94
  • 151
Semas
  • 869
  • 10
  • 22
  • this probably depends on whether you are using WinForms, Web Forms, WPF or SilverLight. Please tell us which. Also, what does this have to do with C#? – John Saunders Aug 10 '10 at 19:28

2 Answers2

2

While this no longer applies as the question has been clarified to target winforms, in Web Forms you can set the ScrollBars property to ScrollBars.Horizontal.

sgriffinusa
  • 4,203
  • 1
  • 25
  • 26
  • Doesn't exist (in winforms, the question applies to winforms) – Arafangion Mar 05 '12 at 07:58
  • The original question did not specify winforms. It has since been clarified, but this answer may still be useful to searchers. – sgriffinusa Mar 05 '12 at 20:38
  • Fair enough, please suggest that http://www.bobpowell.net/understanding_autoscroll.htm be consulted, for winforms, you really need to ensure that you're not using docks or anything other than anchors in child controls, and set the AutoScrollMinSize. Everything falls down to that, really. – Arafangion Mar 06 '12 at 00:15
2

The Panel is derived from ScrollableControl. So there is a property AutoScroll. Just set it to true and the rest will be done automagically.

Oliver
  • 43,366
  • 8
  • 94
  • 151