Only horizontal scrolling in a panel

前端 未结 4 628
情歌与酒
情歌与酒 2021-01-21 03:42

How do I set my panel so it will only scroll horizontal? I have tried:

this.VerticalScroll.Enabled = false;

But it doesn\'t work.

4条回答
  •  温柔的废话
    2021-01-21 04:12

    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);
    

提交回复
热议问题