简体   繁体   English

WM_PAINT多次批注化吗?

[英]WM_PAINT Bitblitting multiple times?

This is for C++ - win32. 这是用于C ++-win32。 Basically I've loaded an image (bmp) into a HBITMAP from a file and bitblitted it to the device context for the main window. 基本上,我已经从文件将图像(bmp)加载到HBITMAP中,并将其位图化为主窗口的设备上下文。

How would I call it again in case I want to change the image? 如果要更改图像,我又怎么称呼它?

I've called InvalidateRectangle() and UpdateWindow() but that causes the window controls to flicker. 我已经调用了InvalidateRectangle()和UpdateWindow(),但这会导致窗口控件闪烁。

Normally you invalidate the area (eg via InvalidateRect ) and let your WM_PAINT handler repaint it. 通常,您使该区域无效(例如,通过InvalidateRect ),并让您的WM_PAINT处理程序重新绘制该区域。 Reasons why you would get flicker often are because you haven't overridden the WM_ERASEBKGND handler, your WM_PAINT handler isn't doing double-buffered painting, or you're invalidating (or repainting) an area larger than you need to. 之所以经常出现闪烁,是因为您没有覆盖WM_ERASEBKGND处理程序, WM_PAINT处理程序没有进行双缓冲绘画,或者使(或重新绘画)了一个超出所需范围的区域。

This page might help: Flicker-free Drawing: Techniques to eliminate flicker from your applications 此页面可能会有所帮助:无闪烁绘图:消除应用程序闪烁的技术

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM