On the form, you place a Panel
and set: its Dock
property to Fill
, and AutoScroll
property to True
.
You place all the other controls inside this panel, but not the button you want to keep visible.
Right-click on the panel->Send-to-Back.
The Panel
will adjust the size to match the form; the scrolling will only happen in the panel, so the button will always stay visible(you can set Anchor:Left,Top on it)
In order to be able to scroll(with the mouse wheel), the focus must be on a control inside the scrollable area(inside the Panel
), NOT on the button. To prevent the button from getting focus: set TabStop
to false
on it; also, when it is clicked, you must also set the focus on an other control, by calling:
this.SelectNextControl(the_button, true, true, true, true);