InvalidateRect() Invalidate() UpdateWindow()

本文介绍了Windows绘图中InvalidateRect和UpdateWindow等函数的作用及使用方法。InvalidateRect用于指定区域无效化,可避免大面积重绘;UpdateWindow则直接发送WM_PAINT消息更新窗口,不受ON_PAINT队列限制。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

总结:

InvalidateRect(rectNew, TRUE);
  //Invalidates the client area within the given
  //rectangle by adding that rectangle to the CWnd update region.

 

  UpdateWindow();
  //Updates the client area by sending a WM_PAINT
  //message if the update region is not empty.

 

  //The UpdateWindow member function sends a WM_PAINT
  //message directly, bypassing the application queue.
  //If the update region is empty, WM_PAINT is not sent.

 

  Invalidate(FALSE);
  // Invalidates the entire client area of CWnd.

 

除了UpdateWindow()可以避开ON_PAINT队列,直接发送消息,其它都是执行完其后的程序再响应ON_PAINT.

InvalidateRect()可以避免大范围的重绘.

 

还可参考:

http://www.cnblogs.com/buffer/archive/2009/03/11/1408347.html

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值