本文介绍了黑色DataGridViewComboBoxCell的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何解决吗?当我在datagridview中单击comboboxcell时,背景变为黑色. .

Hi, somebody know how solve it? when i click on a comboboxcell in a datagridview, the background turns black . . .

 

查看此图片

 

推荐答案

我是此控件的新手,所以我希望有一种更简单的方法来完成此操作.这似乎完全是黑客.如果您找到它,请告诉我!

I'm new to this control, so I hope there's a much easier way to accomplish this. This seems like a total hack. If you find it please let me know!

像这样的事情:(对C#发布很抱歉,但这就是我在这里使用的.我认为这还是有帮助的.)

Something like this: (Sorry about the C# posting, but that's what I'm using here. I thought this would be helpful nonetheless.)

私有 组合框 EditingCombo = ;
私有 无效 grid_EditingControlShowing( 对象 发送者, DataGridViewEditingControlShowingEventArgs e)
{
EditingCombo = e.Control as ComboBox ;
  
如果 (EditingCombo == null ) 返回 ;
    EditingCombo.DropDown + = OnEditingComboDropDown;
}
私有 void OnEditingComboDropDown( 对象 发件人, EventArgs e)
{
((( 组合框 )发送者).BackColor= Color .White;
}

private ComboBox EditingCombo = null;
private void grid_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
    EditingCombo = e.Control as ComboBox;
   
if (EditingCombo == null) return;
    EditingCombo.DropDown += OnEditingComboDropDown;
}
private void OnEditingComboDropDown(object sender, EventArgs e)
{
    ((ComboBox)sender).BackColor = Color.White;
}

干杯,
Alex


这篇关于黑色DataGridViewComboBoxCell的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 22:50