[Mono-winforms-list] Copy rather than drawing an image to a graphics object?

Stifu stifu at free.fr
Wed Jan 5 08:10:40 EST 2011


Hi,

How about defining clip regions for the parts that should be transparent,
before calling Clear?
However, I remember getting into issues doing something similar with Mono.
It worked fine with .NET, though.
See: https://bugzilla.novell.com/show_bug.cgi?id=492299


cs_eps wrote:
> 
> Hello!
> 
> I use the classic double buffering pattern for drawing a user control
> avoiding flicker
> 1) override the OnPaintBackground with an empty body
> 2) in the OnPaint override draw all stuff (including the background) in a
> buffer bitmap and draw it at the end with the graphics object in the event
> args with eventArgs.Graphics.DrawImage.
> 
> This works fine if the control has a solid color, but my control has a
> transparent background. It is kind of a window on a video frame with some
> overlay graphics.
> 
> The problem is that DrawImage paints the new image on the old image
> because of the transparent backgound. The only way to avoid this, is to
> call eventArgs.Graphics.Clear(Color.Transparent) before calling the
> DrawImage (could be done in OnDrawBackground)... but this flickers!
> 
> So I need to copy rather than draw the image. Any idea on how to achieve
> this?
> 

-- 
View this message in context: http://mono.1490590.n4.nabble.com/Copy-rather-than-drawing-an-image-to-a-graphics-object-tp3175423p3175489.html
Sent from the Mono - WinForms mailing list archive at Nabble.com.


More information about the Mono-winforms-list mailing list