Datagridview编辑时单元格颜色变为黑色 [英] Datagridview Cell color changes to black when editing

查看:596
本文介绍了Datagridview编辑时单元格颜色变为黑色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨...

我第二次使用datagridview并再次遇到同样的问题。我第一次也无法解决它。

网格从数据表中手动填充,用户可以编辑单元格中的值。但是,单元格的背面颜色变为黑色,您无法看到正在键入的内容。一旦用户离开单元格,颜色就会恢复正常,并且值也已更改。但由于细胞将颜色变为黑色(与字体相同),用户无法看到他/她正在输入的东西,这很疯狂。

对此有任何帮助都将受到赞赏。之前已经提出过这个问题,但没有提供有效的解决方案。

解决方案

你可以像这样改变颜色

         private void dataGridView_CellContentClick(object sender,DataGridViewCellEventArgs e)
        {
            dataGridView.CurrentCell.Style.BackColor = Color.White;
       希望这对你有所帮助。 :)

Hi...

Im using a datagridview for the second time and run into the same problem again. I was not able to resolve it the first time either.

The grid is filled in manually from a datatable and the user can edit the values in the cells. But the back color of the cell changes to black and you cannot see what you're typing in. Once the user leaves the cell, the colors are back to normal and the value has also been changed. But its crazy that the user cannot see what he/she is typing in because of the cell changing color to black (same as font).

Any help on this would be appreciated. This question has been asked before but no effective solution was provided.

解决方案

You can change color like this

        private void dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            dataGridView.CurrentCell.Style.BackColor = Color.White;
        }

Hope this helps you. :)


这篇关于Datagridview编辑时单元格颜色变为黑色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆