How do I set my panel so it will only scroll horizontal? I have tried:
this.VerticalScroll.Enabled = false;
But it doesn\'t work.
It works using this code in my panel:
protected override void WndProc(ref System.Windows.Forms.Message m)
{
ShowScrollBar(this.Handle, 1, false);
base.WndProc(ref m);
}
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool ShowScrollBar(IntPtr hWnd, int wBar, bool bShow);
Try this instead for 'only' scrolling horizontal.
(auto scroll needs to be false b4 it will accept changes)
mypanel.AutoScroll = false;
mypanel.VerticalScroll.Enabled = false;
mypanel.VerticalScroll.Visible = false;
mypanel.VerticalScroll.Maximum = 0;
mypanel.AutoScroll = true;
If your panel does not perform AutoScroll, you can use its VScroll property:
yourPanel.VScroll = false;
you can try
panel.AutoScroll = true;
panel.HorizontalScroll.Enabled=false;
panel.HorizontalScroll.Visible = false;