例子:
DataGridView dv = this.dataGridView1; //自定义普通文本列 DataGridViewTextBoxColumn dc3 = new DataGridViewTextBoxColumn(); dc3.Name = "FMapName"; dc3.DataPropertyName = "FMapName"; dc3.HeaderText = "对应名称"; dc3.ReadOnly = true; dv.Columns.Add(dc3); //自定义ComboBox列(整个列的每一行都有一个ComboBox控件) DataGridViewComboBoxColumn dc2 = new DataGridViewComboBoxColumn(); dc2.HeaderText = "对应代码"; dv.Columns.Add(dc2); //注意要加上这句才能添加