datagrid|下拉|下拉列表
private void AddGrdComBox()//在datagrid列中添加下拉列表
{
DataGridTextBoxColumn dgtb = (DataGridTextBoxColumn)grd_please.TableStyles[0].GridColumnStyles[8]; //8是列的序号
ComboBox cmbFunctionArea = new ComboBox();
cmbFunctionArea.Items.AddRange(new object[]{"正本","副本","原稿"});
cmbFunctionArea.Cursor = Cursors.Arrow;
cmbFunctionArea.DropDownStyle= ComboBoxStyle.DropDownList;
cmbFunctionArea.Dock = DockStyle.Fill;
cmbFunctionArea.SelectionChangeCommitted += new EventHandler(cmbFunctionArea_SelectionChangeCommitted);
dgtb.TextBox.Controls.Add(cmbFunctionArea);
}
时间: 2024-10-30 13:24:56