Scrollable Form in c#, AutoScroll=true doesn't work

后端 未结 3 1517
我在风中等你
我在风中等你 2020-12-19 07:26

What are the rules which I have to respect to make the Form scrollable...

I simple set the Property AutoScroll to true. I also tried while Auto Sc

3条回答
  •  醉酒成梦
    2020-12-19 08:22

    The AutoScroll property should work fine, but most likely you are not using it right: the bar appears only when required. Example: minimum Y of the Form is 0 and minimum Y of one of the controls in it (a TextBox) is -20.

    If you want to include a scroll bar no matter what (controls inside the boundaries of the form or not), you can also do it. Sample code (from MSDN) for a vertical scroll bar:

    // Create and initialize a VScrollBar.
    VScrollBar vScrollBar1 = new VScrollBar();
    
    // Dock the scroll bar to the right side of the form.
    vScrollBar1.Dock = DockStyle.Right;
    
    // Add the scroll bar to the form.
    Controls.Add(vScrollBar1);
    

提交回复
热议问题