当前位置:网站首页>DataGridView在多线程中出现大红叉
DataGridView在多线程中出现大红叉
2022-08-09 02:21:00 【yutiedun】
项目中做了一个多线程实现 DataGridView 动态刷新数据,但是在动态刷新数据N次之后,DataGridView 突然变成一个大红叉。
处理的方法,重新封装 DataGridView 控件,重写 OnPaint 方法,代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace XuexiIefeel
{
public class DataGridViewIefeel : DataGridView
{
protected override void OnPaint(PaintEventArgs e)
{
try
{
base.OnPaint(e);
}
catch
{
Invalidate();
}
}
}
}
然后在项目中所有用到 DataGridView 的地方都替换成 DataGridViewIefeel,问题解决。
边栏推荐
猜你喜欢

MT4/MQL4 Getting Started to Mastering EA Tutorial Lesson 1 - MQL Language Common Functions (1) OrderSend() Function

Codeforces Round #809 (Div. 2)A~D1

历史最全DL相关书籍、课程、视频、论文、数据集、会议、框架和工具整理分享

D. Tournament Countdown

如何最大限度地减少企业受到供应链攻击的风险

etcd实现大规模服务治理应用实战

数据库设计的总结

D. Tournament Countdown

2022年自然语言处理校招社招实习必备知识点盘点分享

力扣刷题记录4.1-----209. 长度最小的子数组
随机推荐
电磁辐射安全标准及检测方法
Using ngrok on Raspberry Pi (Extra 2)
线段树知识整理
eladmin容器部署超详细过程
2022 China Eye Expo, China Beijing International Children and Adolescent Eye Health Industry Exhibition
数字孪生+燃气管理,开启智慧燃气管理新模式
[C language brush questions] Application of fast and slow pointers in linked lists
如何最大限度地减少企业受到供应链攻击的风险
PMP有什么答题技巧?
New Swagger3.0 tutorial, OAS3 quick configuration guide, to automate API interface documentation!
2022眼康品牌加盟展,北京视力保健展,中国眼科医学技术峰会
使用JS实现数组扁平化的几种方式
Use of torchversion.transforms
力扣刷题记录3.1-----977. 有序数组的平方
力扣刷题记录--常用功能函数
yii2的安装之路
The most fierce "employee" in history, madly complaining about the billionaire boss Xiao Zha: So rich, he always wears the same clothes!
Etcd realize large-scale application service management of actual combat
企业里Foxmail邮箱问题解决方法汇总
.reduce()的简单例子