1

I have create (I am using Visual Studio 2012) winform that have this proprities:

  • Width: 812
  • Height: 667
  • FormBorderStyle: Fixed 3D

In right side of put vScrollBar (that have height: 599px, which is exactly the size in my fixed form). Now I whant that my form height would be heigher then 667px, and with help of scrollbar, you scroll to bottom of form. Let me put it in picture:

enter image description here

Now I whant to create If you scroll with scroll bar textboxs and etc. moves down, so you can see textboxes that are at the moment hidden (they are down of form).

So far I do not have any code.

Is there any tutorial that could help me. Realy thanks for help.

DaniKR
  • 2,418
  • 10
  • 39
  • 48
  • 1
    you can look here for help: http://stackoverflow.com/questions/6090558/add-vertical-scroll-bar-to-panel – yossico Sep 24 '14 at 07:10
  • How do you add the controls in this form? code or design? – Mehdi Khademloo Sep 24 '14 at 07:15
  • @MehdiKhademloo with design – DaniKR Sep 24 '14 at 07:17
  • 4
    Set the form's `AutoScroll=true`. – TaW Sep 24 '14 at 07:19
  • Make it large enough in the designer while you add those controls in the lower part; then make it smaller again, either in the designer or in the code. where is the problem? – TaW Sep 24 '14 at 07:24
  • 1
    Here is a special trick I found useful. I would do it like this: Add a hidden tab control with enough pages holding one panel each to put in all the stuff you want in your window. at form load I would add those panels to a flowlayoutpanel in the window. this way you can do everything designer and still get the extra large scrollable area – TaW Sep 24 '14 at 07:33
  • @TaW also thanks for help, also good solution – DaniKR Sep 24 '14 at 07:34
  • No, if we do this solution, the scrollBar is appeared and we can scrollDown in Design-time, and add our Control, then, it's independent in the ScreenSize. – Mehdi Khademloo Sep 24 '14 at 07:42
  • @TaW What is the point of the tab control in your trick? You can just create panels (or better yet, UserControls). – Cody Gray - on strike Sep 24 '14 at 09:18
  • 1
    The point is to have them all visible in the designer at only one click. Of couse with usercontrols you have that too, but they are separate from the form, so they don't interact well in code. And on the Form Panels take space, so the least you'd have to do is scroll down until you find the one you want to change. In a Tab they're all lined up with a nice header.. (The trick is also imo the best way to switch between Panels..) Here dumping them into a FLP at startup would solve the OP nicely. ymmv – TaW Sep 24 '14 at 10:11

2 Answers2

8

You can add a FlowLayoutPanel and set the these properties to that:

 flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
 flowLayoutPanel1.WrapContents = false;
 flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
 flowLayoutPanel1.AutoScroll = true;

and you can see the scroll, you can use the Panels and design your application.


Or completely different, You can set the this.AutoSize = true; and drag one control to outer of form(big and small the size) and then, you can see the scrollBar of form.

Mehdi Khademloo
  • 2,754
  • 2
  • 20
  • 40
  • first solution it is much better for me, because I have menu on the top of win form, and I do not whant that is scrolled. Thanks man! – DaniKR Sep 24 '14 at 07:33
  • it's your choice, I prefer the second one, Thanks to @TaW for the offer, – Mehdi Khademloo Sep 24 '14 at 07:34
  • 1
    @kr neki res: You are contradicting your own question here; which ok, we all learn.. But you may want to consider using a regular Panel with AutoScroll=true. It'll scroll fine and you can work on it in the designer more like working on a form; no need to use the FLP's methods. FLPs are great for dynamically created content, but a pain in the designer, imo, because they try to float stuff I'd rather place where I want it..With a Panel there is no need for trickes like spacer etc.. – TaW Sep 24 '14 at 07:39
  • excellet @Taw, your advice is also great, I have try it – DaniKR Sep 24 '14 at 07:53
  • I recommend that you reparent the main controls in a Panel, and parent the Panel in a ToolStripContainer. That way you can have a menu and/or a status bar that don't scroll but the rest of the form will. – Mozzis Jul 10 '19 at 19:53
0

You can simply try this.AutoScroll = true; which will make automatic scrolling

Ali
  • 2,702
  • 3
  • 32
  • 54
shan
  • 1