惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V2EX - 技术
V2EX - 技术
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Latest news
Latest news
T
The Exploit Database - CXSecurity.com
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
L
Lohrmann on Cybersecurity
aimingoo的专栏
aimingoo的专栏
B
Blog
T
Threat Research - Cisco Blogs
罗磊的独立博客
Application and Cybersecurity Blog
Application and Cybersecurity Blog
P
Proofpoint News Feed
P
Palo Alto Networks Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
宝玉的分享
宝玉的分享
博客园 - 司徒正美
Google DeepMind News
Google DeepMind News
Blog — PlanetScale
Blog — PlanetScale
T
Tor Project blog
阮一峰的网络日志
阮一峰的网络日志
Last Week in AI
Last Week in AI
Martin Fowler
Martin Fowler
酷 壳 – CoolShell
酷 壳 – CoolShell
Recorded Future
Recorded Future
D
DataBreaches.Net
Y
Y Combinator Blog
大猫的无限游戏
大猫的无限游戏
IT之家
IT之家
B
Blog RSS Feed
Scott Helme
Scott Helme
P
Proofpoint News Feed
V
Vulnerabilities – Threatpost
A
Arctic Wolf
Help Net Security
Help Net Security
L
LINUX DO - 最新话题
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Vercel News
Vercel News
AWS News Blog
AWS News Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
S
Schneier on Security
Hacker News: Ask HN
Hacker News: Ask HN
N
Netflix TechBlog - Medium
L
LangChain Blog
博客园 - 叶小钗
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
M
MIT News - Artificial intelligence
N
News and Events Feed by Topic
Webroot Blog
Webroot Blog
W
WeLiveSecurity

博客园 - Blue

个已实现的例子:通过Javascript在页面中直接调用Office Communicator API - Blue cmd脚本(C# 清缓存) - Blue - 博客园 isql脚本编写创建数据库(SQL Server2000) 怎样踢mstsc占用者 copy:键盘按键和键盘对应代码表 Thread简单概念 Regsvr32命令全攻略 导入导出CVS文件遇到的问题 - Blue - 博客园 一个字段存很多枚举值,然后从字段取出的方法 關於泛型的資料 索引器的两种用法 在建表时使用DEFAULT是很有用的 关于web service的验证 SQL中计算月初和月末 临时表有时很有用 在GROUP语句中还可以增加很多内容 注意insert语句写法 case的用法 尽量减少使用游标
转:ListView 中添加大数据量解决屏幕刷新“闪”的现象
Blue · 2008-08-28 · via 博客园 - Blue

作者:rhythm

  1. ListView 中添加大数据量解决屏幕刷新“闪”的现象。

listview中添加超过10000条或更多的数据时,如果我们一条条添加,屏幕会闪的厉害,如果我们一次性添加,可能我们要等上很长时间才能出现结果。

为了解决(准确的是减轻)这个问题,我们采用ListView的方法AddRange(),配合BeginUpdate() EndUpdate() 使用。

FillListView()

{

     Int TotalRecord = 10008;  //总的记录数

     Int EveryTimeRecord = 100; //每次批量增加的数量

     Int TotalTimes = Math.Floor(TotalRecord / EveryTimeRecord);//批量添加的执行次数

     For(int I = 0; I < TotalTimes; i++)

     {

          ListViewItem[] listViewItems;  //声明listviewitem集合,以便满足AddRange所需的参数

          If(I < TotalTimes - 1)   //I 不是最后一次执行

          {

                   listViewItems = new ListViewItem[initCount];

                   for ( int j  = 0; j < EveryTimeRecord; j++ )

              {

                   int indexRecord = j + i * EveryTimeRecord; // 记录的索引

                   listViewItems[i] = new ListViewItem( );

              listViewItems[i] = AddListViewItem ( batchDocuments[indexRecord] );

}

          }

          Else //最后一次执行,剩下的余数

          {

                   int lastQuantity = TotalRecord - EveryTimeRecord * i;

                   listViewItems = new ListViewItem[lastQuantity];

                   for ( int j = 0; j < lastQuantity; j++ )

                   {

                   int indexRecord = j + i * EveryTimeRecord; // 记录的索引

                   listViewItems[i] = new ListViewItem( );

              listViewItems[i] = AddListViewItem ( batchDocuments[indexRecord] ); //将一个已知listviewitem赋值给声明的listviewitem

              }

}

ListView.BeginUpdate();

               ListView.Items.AddRange( listViewItems );  //利用AddRange批量增加,目的是减少刷屏次数,减轻不断闪烁问题。

ListView.EndUpdate();

     }

}