I wish to make custom horizontal scrollbar that would be longer than width of panel that I would like to scroll with it. How to connect it?
ScrollBar hScrollBar = new HScrollBar();
hScrollBar.Dock = DockStyle.Fill;
ScrollBar.Scroll += new ScrollEventHandler(hScrollBar_Scroll);
splitContainer2.Panel2.Controls.Add(hScrollBar);
void hScrollBar_Scroll(object sender, ScrollEventArgs e)
{
?
}
You mean like this?
Just put the controls in the panel, size the form and put this code
after InitializeComponent
If you want a “real custom” scroll bar, do something like this:
But you must find the maximum value, in my case aprox 700.