我点击System.Windows.Forms.Panel(面板)的滚动条,会触发什么事件?
我需要在点击滚动条时做一些处理

解决方案 »

  1.   

    上wwww.codeproject.com吧。上面有一个ScrollablePanel例子,你照着修改一下,就能实现捕获滚动条的事件了。
      

  2.   

    public class vscrollBar : System.Windows.Forms.VScrollBar
    {
    public vscrollBar()
    {

    }
    }public class hscrollBar : System.Windows.Forms.HScrollBar
    {
    public hscrollBar()
    {

    }
    }
    这样简单的继承一下
    然后加到你想要的地方
    private vScrollBar vscrollBar;
    private hScrollBar hscrollBar;this.vscrollBar = new vScrollBar();
    this.hscrollBar = new hScrollBar();
    this.vscrollBar.Dock = DockStyle.Right;
    this.vscrollBar.Location = new Point(336, 0);
    this.vscrollBar.Name = "vscrollBar";
    this.vscrollBar.Size = new Size(16, 256);
    this.hScrollBar.Dock = DockStyle.Bottom;
    this.hScrollBar.Location = new Point(0, 240);
    this.hScrollBar.Name = "hScrollBar";
    this.hScrollBar.Size = new Size(336, 16);
    this.vscrollBar.Minimum = 0;
    this.vscrollBar.Value = 0;
    this.vscrollBar.SmallChange = 20;
    this.vscrollBar.LargeChange = 20;
    this.hScrollBar.Minimum = 0;
    this.hScrollBar.Value = 0;
    this.hScrollBar.SmallChange = 20;
    this.hScrollBar.LargeChange = 20;
    this.vscrollBar.ValueChanged += new EventHandler(VScrollBarValueChanged);
    this.hScrollBar.ValueChanged += new EventHandler(HScrollBarValueChanged);
    this.vscrollBar.TabStop = false;
    this.hScrollBar.TabStop = false;private void VScrollBarValueChanged(object sender, EventArgs e)
    {
    //todo
    }private void HScrollBarValueChanged(object sender, EventArgs e)
    {
    //todo
    }
      

  3.   

    我是webapp的,那个事件你可以自己改