WinForm 加载大数据时不闪烁的ListView
2024-08-31 14:40:42
自己之前做小工具的时候,遇到这个问题,记录一下。。。
namespace 相册处理 { //将ListView重载为此新类,解决加载过程中闪烁的问题 //在designer.cs中改写: //private ListViewNeverFlickering listView1; //this.listView1 = new ListViewNeverFlickering(); internal class ListViewNeverFlickering : System.Windows.Forms.ListView { public ListViewNeverFlickering() { // Activate double buffering this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true); // Enable the OnNotifyMessage event so we get a chance to filter out // Windows messages before they get to the form's WndProc this.SetStyle(ControlStyles.EnableNotifyMessage, true); } protected override void OnNotifyMessage(Message m) { //Filter out the WM_ERASEBKGND message if (m.Msg != 0x14) { base.OnNotifyMessage(m); } } } }
最新文章
- 13.代理模式(Proxy Pattern)
- Python 简单爬虫
- 《零成本实现Web自动化测试--基于Selenium》 第五章 Selenium-RC
- java新手笔记12 单例
- cookie 和 HttpSession
- nova-network创建初始化网络
- MFC 在对话框显示图片的多种方法(四种方法)
- fopen中的mode(20161115)
- Django_404_403_500页面处理
- PAT 1152 Google Recruitment
- 设置LISTControl控件某一行的背景和文字颜色
- 19、AJAX
- C++学习(三十六)(C语言部分)之 链表2
- python基本数据类型之字符串(二)
- java也可以做黑客?
- Delphi 10.3.1 TNetHttpClient在多线程中存在的问题及解决方法。
- dubbo Framework pic
- jni使用javap查看java类方法签名
- vs2015新建web应用程序空模板和添加webapi的模板生成文件的比较
- LeetCode:寻找数组的中心索引【668】