齐心协力解决问题:如何检查DataGrid中是否出现了垂直滚动条?

解决方案 »

  1.   

    是web的还是winform的
    帮你UP
      

  2.   

    呵呵,是winform的,不好意思。多谢你 了。再给指点一下把。
      

  3.   

    我也没有找到好的方法,不过有一个折衷的方案我是这样做的,先用remotesoft反编译system.windows.form.dll中的DataGrid控件
    在代码中发现有一个字段private ScrollBar vertScrollBar(对应protected ScrollBar VertScrollBar),当DataGrid重绘的时候它会设置它的visible属性
    所以
    using System;
    using System.Windows.Forms;
    public class myDataGrid :System.Windows.Forms.DataGrid 
    {
    protected override void OnPaint(PaintEventArgs pe)
    {
    base.OnPaint(pe);
    if ( this.VertScrollBar.Visible )
    {
    //做你想做的,触发个事件什么的
    } }
    }
    困了,睡觉了,hope it helps you!
      

  4.   

    youwanna(^o^)  的方法有意思啊