【发布时间】:2015-12-08 18:55:56
【问题描述】:
private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
int n = dataGridView1.CurrentCell.RowIndex;
if (dataGridView1.CurrentCell.ColumnIndex == 0)
{
var cbCell = dataGridView1.Rows[n].Cells["category"] as DataGridViewComboBoxCell;
DataTable dt = c1.ret("select category from category").Tables[0];
cbCell.DataSource = dt;
cbCell.ValueMember = "category";
cbCell.DisplayMember = "category";
cbCell.FlatStyle = FlatStyle.System;
}
}
我正在尝试为 datagrid 组合框设置数据源,但是当我设置数据源时。组合框颜色的下拉列表变为黑色。我尝试了一些设置背景颜色的代码,但每个代码都失败了。现在我被我的项目困住了。请帮帮我....
【问题讨论】:
标签: c# background-color datagridviewcombobox