当前位置:网站首页>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,问题解决。
边栏推荐
- JDBC技术(一)——一个简单的JDBC测试
- 9.1-----24. Swap the nodes in the linked list in pairs
- Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules
- Which is the best increased whole life insurance?Is it really safe?
- 10.1-----19. Delete the Nth node from the bottom of the linked list
- Programmer's Daily Life | Daily Fun
- 2022/8/8 比赛思维+状压dp
- How js implements array deduplication (7 kinds)
- 最强分布式锁工具:Redisson
- eladmin容器部署超详细过程
猜你喜欢
Mysql 5.7 into the pit
2022PMP项目管理认证考试报考指南(1)
【izpack】使用izpack为你的程序提供安装程序封装
How to install ngrok in Synology system (Synology 6.X version)
JDBC technology (2) - set up common sql and configuration files
Summary of pytorch related knowledge points
SEMRush如何寻找关键词用于投放广告
The most fierce "employee" in history, madly complaining about the billionaire boss Xiao Zha: So rich, he always wears the same clothes!
力扣刷题记录6.1-----203. 移除链表元素
数字孪生+燃气管理,开启智慧燃气管理新模式
随机推荐
Line segment tree of knowledge
js实现数组去重的方式(7种)
右键新建缺少word、excel选项问题处理
使用JS实现数组扁平化的几种方式
Codeforces Round #809 (Div. 2)A~D1
SEMRush如何寻找关键词用于投放广告
.reduce()的简单例子
The security of the pension insurance?Reliable?
方法参数
2.1-----27. Remove elements
低代码开发创新企业应用构建模式
数据库设计的总结
9.1-----24. Swap the nodes in the linked list in pairs
2020.12.4 log
历史最全DL相关书籍、课程、视频、论文、数据集、会议、框架和工具整理分享
Difference between KQL and Lucene
虹科技术|如何阻止供应链攻击?
[C language brush questions] Application of fast and slow pointers in linked lists
JDBC technology (3) - use Druid database connection pool test
Flume (四) --------- Flume 企业开发案例