在datagrid列中添加下拉列表

类别:.NET开发 点击:0 评论:0 推荐:

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);            


  }

本文地址:http://com.8s8s.com/it/it43476.htm