.DrawInto Windows oddness

[quote=332900:@Norman Palardy]We draw the control into a picture and that picture is double buffered
No magic

Unless you misunderstood and think we double buffer the CONTROL ? (which is NOT what I meant)[/quote]

I would love to see a code example of how the double buffering is done.

I can tell you
Create a picture to act as the buffer
Draw everything into that (best part is you can draw whenever you want not JUST in the paint event)
Then in the Paint event draw that picture into the passed graphic
Done

[quote=332990:@Norman Palardy]I can tell you
Create a picture to act as the buffer
Draw everything into that (best part is you can draw whenever you want not JUST in the pain event)
Then in the Paint event draw that picture into the passed graphic
Done[/quote]

I’ve been working on this using declares. Using CreateCompatibleDC and CreateCompatibleBitmap and BitBlt. I’ve been trying to double buffer an entire canvas with controls on it this way. So far I haven’t got it working correctly.

Thanks.

I can believe you have issues getting it to work since you’d need to redirect the entire canvas drawing to a new DC.
And I’m not sure you can get that to happen.

Why go complex declares when double buffering is only one canvas with double buffer on away ?

I don’t mind declares I’ve been working with them so much lately they’ve actually helped me learn quite a bit.

Two reasons really.

  1. I found BitBlt much better quality than DrawInto.
  2. I was never able to get a picture to scale properly for me on window resize. It would either stretch or change in height. I may end up coming back to this for another try.

@Norman Palardy You were right I had to give up on CreateCompatibleDC and CreateCompatibleBitmap.

I finally did figure out how to create a canvas that you can stack controls on and resize the window and it never flickers again. I also wrote code that will do the same for individual controls using the same double buffering method. I’m thinking of writing a no flicker double buffer plugin for Xojo on Windows when I finish my current project.

Too bad Windows doesn’t do this right in the win32 api for you

Hi Geoff,

Glad to hear you found a way to create a canvas without flicker. I would like to know If you would share the rough outline of code. I am working on a project and am getting some flickering and this would be very helpful. :slight_smile: