DataGridColumnStyle col;

col = new DataGridTextBoxColumn();
col.MappingName = "实配船名航次";
col.HeaderText = "实配船名航次";
col.Width = 200;
col.ReadOnly=true;
DGStyle.GridColumnStyles.Add(col);指定MappingName就可以指定到你想要的列了

解决方案 »

  1.   

    當然,但我要的欄位是指它在DataGrid中顯示的順序,
    即我要把新加入的列放到DataGrid的中的第一欄顯示.
      

  2.   

    不能,要么这样添加,比较容易调整顺序
    AddRange( new DataGridColumnStyle[] { c1,c2,c3 } )
      

  3.   

    自定义一个MyDataGridTableStyle
    添加一个方法AddAt,可以实现
      

  4.   

    to oh_love(小熊)
    AddRange( new DataGridColumnStyle[] { c1,c2,c3 } )
    这具有问题吧F:\My Project\PlanSystem\PlanSystemApp\PlanApp\frmTest3.cs(97): 与“System.Windows.Forms.GridTableStylesCollection.AddRange(System.Windows.Forms.DataGridTableStyle[])”最匹配的重载方法具有一些无效参数
      

  5.   

    DataGridTextBoxColumn c1 = new DataGridTextBoxColumn();
    DataGridTextBoxColumn c2 = new DataGridTextBoxColumn();
    DataGridTextBoxColumn c3 = new DataGridTextBoxColumn();new System.Windows.Forms.DataGridTableStyle().GridColumnStyles.AddRange(
    new DataGridColumnStyle[] 
    {
    c1,c2,c3
    });
      

  6.   

    ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.2052/cpref/html/frlrfSystemWindowsFormsGridTableStylesCollectionClassTopic.htm看看帮助吧!
      

  7.   

    再重新生成一次各个GridColumnStyle
      

  8.   

    他应该有一个insert方法吧,用insert方法可以控制插入的位置,用add是把它放在最后一列