加上以下语句:
this.dataGrid1.TableStyles.Clear();
DataGridTableStyle ts = new DataGridTableStyle();
ts.GridColumnStyles[i].Width = <你要的宽度>;
........
this.dataGrid1.TableStyles.Add(ts);

解决方案 »

  1.   

    // 
    // myTableStyle
    // 
    this.myTableStyle.AlternatingBackColor = System.Drawing.SystemColors.Info;
    this.myTableStyle.BackColor = System.Drawing.SystemColors.Info;
    this.myTableStyle.DataGrid = null;
    this.myTableStyle.GridColumnStyles.AddRange(new System.Windows.Forms.DataGridColumnStyle[] {
       this.myColumnStyle1,
       this.myColumnStyle2,
       this.myColumnStyle3,
       this.myColumnStyle4});
    this.myTableStyle.HeaderForeColor = System.Drawing.SystemColors.ControlText;
    this.myTableStyle.MappingName = "ParentTable";
    // 
    // myColumnStyle1
    // 
    this.myColumnStyle1.Format = "";
    this.myColumnStyle1.FormatInfo = null;
    this.myColumnStyle1.HeaderText = "序号";
    this.myColumnStyle1.MappingName = "序号";
    this.myColumnStyle1.ReadOnly = true;
    this.myColumnStyle1.Width = 40;//*******
    // 
    // myColumnStyle2
    // 
    this.myColumnStyle2.Format = "";
    this.myColumnStyle2.FormatInfo = null;
    this.myColumnStyle2.HeaderText = "地址";
    this.myColumnStyle2.MappingName = "地址";
    this.myColumnStyle2.ReadOnly = true;
    this.myColumnStyle2.Width = 50;//***********
    // 
    // myColumnStyle3
    // 
    this.myColumnStyle3.Format = "";
    this.myColumnStyle3.FormatInfo = null;
    this.myColumnStyle3.HeaderText = "说明";
    this.myColumnStyle3.MappingName = "说明";
    this.myColumnStyle3.ReadOnly = true;
    this.myColumnStyle3.Width = 150;//*********
    // 
    // myColumnStyle4
    // 
    this.myColumnStyle4.Format = "X";
    this.myColumnStyle4.FormatInfo = null;
    this.myColumnStyle4.HeaderText = "数据";
    this.myColumnStyle4.MappingName = "数据";
    this.myColumnStyle4.Width = 75;//*******
    this.myColumnStyle4.NullText="  ";