Control.Refresh - does an Control.Invalidate followed by Control.Update.
Refresh:强制控件使其工作区无效并立即重绘自己和任何子控件。==Invalidate + Update
Control.Invalidate - invalidates a specific region of the Control (defaults to entire client area) and causes a paint message to be sent to the control.
Invalidate: 使控件的特定区域(可以自己设置区域,从而提高性能)无效并向控件发送绘制消息。
Control.Update - causes the Paint event to occur immediately (Windows will normally wait until there are no other messages for the window to process, before raising the Paint event).
Update:使控件重绘其工作区内的无效区域。 立即调用Paint事件。
invalidate:使控件的指定区域无效,有相关重载方法,通常使用情况不多。
update:使控件无效区域进行重绘。一般体现在数据加载等耗时操作过程中。
refresh:使控件区域无效,并重绘控件区域。一般体现在动态加载控件的时候,强制无效并重绘。
Application.DoEvents:交出CPU控制权,让系统可以处理队列中的所有Windows消息。
本文详细解释了控件刷新机制中的关键概念,包括Invalidate、Update及Refresh的区别与联系。Invalidate使控件的特定区域无效并向控件发送绘制消息;Update使控件重绘其工作区内的无效区域,立即调用Paint事件;而Refresh则强制控件及其子控件全部重绘。

440

被折叠的 条评论
为什么被折叠?



