Black background using paint_buffered

Hi,

To avoid flickering during screen updates in a Frame on Windows I
recently switched from

paint do | dc |
#…
end

to

paint_buffered do | dc |
#…
end

The background colour of the Frame is set to WHITE, which is respected
under paint, but is replaced by BLACK under paint_buffered.

The painting jobs seems fine, though all my black lines become invisible
:stuck_out_tongue:

Is there something I can do to sort this out? Perhaps supply my own
buffer…

Thank you!

Regards, Andreas

Andreas W. wrote:

#…

Yes, you can pass your own buffer as an optional argument to
paint_buffered. It should be a Wx::Bitmap of the appropriate height and
width.

I will see if the ruby code that does paint_buffered could make the
bitmap background match the window’s.

a

Dang you Alex,

You beat me to it. :stuck_out_tongue: Actually, another suggestion, would be to use
Wx::DC#draw_rectangle(), in which you set the Pen and Brush with the
color
you want to use.

Simple Example (Not Tested):

pen = Wx::Pen.new(Wx::WHITE) brush = Wx::Brush.new() brush.colour(Wx::WHITE)

dc.set_pen(pen)
dc.set_brush(brush)
dc.draw_rectangle(0,0,self.width,self.height)

… do your drawing here …

L8ers,

Mario S. wrote:

pen = Wx::Pen.new(Wx::WHITE)
brush = Wx::Brush.new()
brush.colour(Wx::WHITE)

dc.set_pen(pen)
dc.set_brush(brush)
dc.draw_rectangle(0,0,self.width,self.height)

… do your drawing here …

Thanks for this workaround. I now have flicker free updates AND a white
background :slight_smile:

I’m looking forward to your update, Alex.

Thanks guys - I’m enjoying wxruby :slight_smile: