在datagridview中的C#红十字 [英] C# red cross in datagridview
本文介绍了在datagridview中的C#红十字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用c#,当我尝试填补我的datagridView大部分时间是一个大的红十字会。
i am using c# and when i try to fill my datagridView most of the time a big red cross apears.
我搜索这个,人们说你有添加
i searched for this and people say that you have to add
public class SafeDataGridView : DataGridView
{
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
try
{
base.OnPaint(e);
}
catch (Exception)
{
this.Invalidate();
}
}
}
我试图添加这个在一个简单的类文件中,但没有做任何事情。
i tried to just add this in a simple class file but that did not do anything.
推荐答案
在YourForm.Designer.cs中查找字符串 gridView = new DataGridView()
并将其替换为
In YourForm.Designer.cs look for string gridView = new DataGridView()
and replace it with
gridView = new SafeDataGridView()
private SafeDataGridView portos_online;
portos_online = new SafeDataGridView();
我希望这将解决您的问题。有一个愉快的一天!
I hope this will solve your problem. Have a nice day!
这篇关于在datagridview中的C#红十字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文