跟小D每日学口语

发条柠檬

使人成熟的是经历,而不是岁月。
  博客园  :: 首页  :: 新随笔  :: 订阅 订阅  :: 管理

datagridview随窗体变化而变化的方式

Posted on 2012-07-20 03:26  发条柠檬  阅读(395)  评论(0)    收藏  举报

1.可以通过dataGridView的Anchor属性调整;

2.通过代码方式调整:

this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;

或者

this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  | System.Windows.Forms.AnchorStyles.Left)
  | System.Windows.Forms.AnchorStyles.Right)));

 

参考: http://topic.csdn.net/u/20101126/13/80c944dc-521a-4e2d-bd24-8d85411cd502.html