当前位置:网站首页>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,问题解决。
边栏推荐
- How to play knowledge graph in recommender system
- 最强分布式锁工具:Redisson
- MT4 / MQ4L entry to the master of EA tutorial lesson two (2) - - MQL language commonly used function account information commonly used functions
- 数据恢复软件EasyRecovery支持恢复所有类型的文件
- 配置文件的读取-TOML
- Open3D 均匀采样
- 2020.10.13 Development log
- The first lesson of HNUMSC-C language
- UsernameAuthenticationFilter授权成功后调用AuthenticationSuccessHandler时的解析
- final
猜你喜欢
随机推荐
Summary of pytorch related knowledge points
电磁辐射安全标准及检测方法
智能视频监控设计摄像头部分
Which is the best increased whole life insurance?Is it really safe?
What is the difference between a project manager and a product manager?
显著性检验--学习笔记
[C language brush questions] Application of fast and slow pointers in linked lists
Line segment tree of knowledge
Go-12-结构体
2.1-----27. Remove elements
Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules
边缘计算的三个关键好处
JDBC技术(二)——设置通用的sql和配置文件
力扣刷题记录3.1-----977. 有序数组的平方
Go-8-Gin框架
spdlog日志库的封装使用
The most fierce "employee" in history, madly complaining about the billionaire boss Xiao Zha: So rich, he always wears the same clothes!
Codeforces Round #809 (Div. 2)A~D1
9.1-----24. Swap the nodes in the linked list in pairs
数字孪生+燃气管理,开启智慧燃气管理新模式









