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()
私有 SafeDataGridView portos_online;
portos_online = new SafeDataGridView();
希望这能解决您的问题.祝你有美好的一天!
I hope this will solve your problem. Have a nice day!
这篇关于datagridview中的C#红十字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文