给groupbox加滚动条。。

时间:2025-01-23 17:09:37
 

 public Form4()
        {
            InitializeComponent();


            foreach (Control gbox in )
            {
                if (gbox is VScrollBar) continue;
                gbox .Tag = ;
            }

     }

 

添加一个vScrollBar控件,加上此事件

      private void vScrollBar2_Scroll(object sender, ScrollEventArgs e)
        {
            foreach (Control gbox in )
            {
                if (gbox is VScrollBar) continue;
                gbox .Location = new Point(gbox ., (int)gbox .Tag - );
            }
        }

 

 

另外将panel的AutoScroll的属性设为ture就可以显示滚动条了了

将滚动条位置置于最低端

  = ;