这个要看你需要了,下面是一个让垂直滚动条总是出现的DataGrid:public class MyDataGrid : DataGrid 
 

  
     public MyDataGrid() 
 
     { 
 
          //make scrollbar visible & hook up handler 
 
          this.VertScrollBar.Visible = true; 
 
          this.VertScrollBar.VisibleChanged += new EventHandler(ShowScrollBars); 
 
     } 
  
     private int CAPTIONHEIGHT = 21; 
 
     private int BORDERWIDTH = 2; 
 
      
 
     private void ShowScrollBars(object sender, EventArgs e) 
 
     { 
 
          if(!this.VertScrollBar.Visible) 
 
          { 
 
               int width = this.VertScrollBar.Width; 
 
               this.VertScrollBar.Location = new Point(this.ClientRectangle.Width - width - BORDERWIDTH, CAPTIONHEIGHT); 
 
               this.VertScrollBar.Size = new Size(width, this.ClientRectangle.Height - CAPTIONHEIGHT - BORDERWIDTH); 
 
               this.VertScrollBar.Show();                     
 
          } 
 
     }