首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Delphi TStringGrid闪烁

Delphi TStringGrid闪烁
EN

Stack Overflow用户
提问于 2010-09-15 03:31:00
回答 3查看 7K关注 0票数 10

我从CSV文件@ runtime向字符串网格添加了多行,但是StringGrid在更新时似乎闪烁了很多,我推测会有一个beginupadate / Endupdate命令来停止它。但是我找不到它。有没有其他方法可以在更新网格id时停止闪烁。

科林

EN

回答 3

Stack Overflow用户

发布于 2011-08-18 05:50:29

迟到总比不到好。我使用WM_SETREDRAW。例如:

代码语言:javascript
复制
...
StringGrid1.Perform(WM_SETREDRAW, 0, 0);
try
  // StringGrid1 is populated with the data here 
finally
  StringGrid1.Perform(WM_SETREDRAW, 1, 0);
  StringGrid1.Invalidate; // important! to force repaint after all
end;
...
票数 19
EN

Stack Overflow用户

发布于 2010-09-15 13:54:37

是的,TStringgrid中没有BeginUpdate/EndUpdate,但每行或每列都有:

StringGrid1.Rows[0].BeginUpdate;

StringGrid1.Cols[0].BeginUpdate;

票数 2
EN

Stack Overflow用户

发布于 2010-09-15 05:28:55

您可以使用窗口函数LockWindowUpdate(AHandle)来阻止控件的刷新,然后使用LockWindowUpdate(0)来重新绘制它。

作为句柄传递Grid.Handle。

票数 -2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3712229

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档