刷新,更新和重绘有什么区别? [英] What's the difference between Refresh, Update and Repaint?

查看:406
本文介绍了刷新,更新和重绘有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道这三种方法最适合我。他们都为我工作有没有人知道刷新,更新和重绘之间的区别?

解决方案

根据在线文档。



刷新< a> - 重新编辑屏幕上的控件。


调用刷新方法立即重新绘制
控件。刷新调用
重绘方法。可以互换使用刷新和
重绘方法。


重绘 - 强制控件在屏幕上重新绘制其图像。


调用重绘强制控件
立即重新绘制其图像。如果
ControlStyle属性包含
csOpaque,控件将直接绘制
。否则,Repaint
方法调用Invalidate方法和
然后Update方法,以便
下的
可见部分的控件也将被重新绘制。


更新 - 立即处理任何待处理的绘图消息。


呼叫更新以强制控制在
之前的任何更多,可能
耗时的处理需要
的地方重新涂上
。使用更新提供立即
的反馈给用户,不能等待
的Windows油漆消息到
到达。



更新不会使
控件无效,而只是强制已经
无效的任何区域的重新绘制
。调用重写代替
也使控件无效。



I don't know which of those three methods suits me most. They all work for me. Does anyone know the difference between Refresh, Update and Repaint?

解决方案

According to the online documentation.

Refresh - Repaints the control on the screen.

Call Refresh method to repaint the control immediately. Refresh calls the Repaint method. Use the Refresh and Repaint methods interchangeably.

Repaint - Forces the control to repaint its image on the screen.

Call Repaint to force the control to repaint its image immediately. If the ControlStyle property includes csOpaque, the control paints itself directly. Otherwise, the Repaint method calls the Invalidate method and then the Update method so that any visible portions of controls beneath the control will be repainted as well.

Update - Processes any pending paint messages immediately.

Call Update to force the control to be repainted before any more, possibly time-consuming, processing takes place. Use Update to provide immediate feedback to the user that cannot wait for the Windows paint message to arrive.

Update does not invalidate the control, but simply forces a repaint of any regions that have already been invalidated. Call Repaint instead to invalidate the control as well.

这篇关于刷新,更新和重绘有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆