Double buffer common controls

前端 未结 8 1102
不思量自难忘°
不思量自难忘° 2020-12-18 07:19

Is there a way to double-buffer the common controls? Currently when they resize they flicker. A lot.....

EDIT: If it helps, it is a bunch of button controls and a fe

相关标签:
8条回答
  • 2020-12-18 07:44

    Without knowing exactly what you're doing, I assume you're using either MFC or Win32 C for this.

    You probably want to do the resize on WM_SIZE message. I'm not sure where you're resizing the controls, but I think you're doing it while it's being resized, which is why it's causing the flicker.

    Also, I'm thinking but I don't know, you could probably use the SetWindowPos function, and for the uFlags, have SWP_NOREDRAW. Though I'm not sure how great this would work for common controls.

    0 讨论(0)
  • 2020-12-18 07:45

    You can create a memory device context, MemDC at the very start. Draw everything into the MemDC, then when the window recieves a WM_PAINT message or is invalidated, copy the MemDC to the real DC by bit blitting.

    I remember reading up the technique by Herbert Schildt in his book a few years back (Windows 98 Programming from the Ground Up). In that way, all the redrawing is faster as you blit the memory dc to the real dc. But the one big gotcha, was how big the memory dc you want to use! But he showed how to do it. There is a code download for all of the chapters in that book published by Osborne McGraw Hill.

    Hope this helps, Best regards, Tom.

    0 讨论(0)
提交回复
热议问题