Double Buffering UserControl in CF 2.0

G

Guest

How to implement flicker-free double-buffering on a user control? I am am
adding a control to a autoscrolling panel on my form. When I scroll with the
panel, the usercontrol is not drawn smoothly. Are there any techniques that
can be applied to remedy this?

I have alreday tried the following:

protected override void OnPaint(PaintEventArgs e)
{
Graphics gxOff = null;
Bitmap m_bmpOffscreen = null;

if (m_bmpOffscreen == null)
m_bmpOffscreen = new Bitmap(ClientSize.Width,
ClientSize.Height);

//e.ClipRectangle.IntersectsWith

gxOff = Graphics.FromImage(m_bmpOffscreen);
gxOff.Clear(this.BackColor);

//Draw from the memory bitmap
e.Graphics.DrawImage(m_bmpOffscreen, e.ClipRectangle,
e.ClipRectangle, GraphicsUnit.Pixel);
//base.OnPaint(e);
gxOff.Dispose();
}

protected override void OnPaintBackground(PaintEventArgs e)
{
}
 
C

Chris Tacke, eMVP

And the RoundGauge in the SDF actually shows a triple-buffered custom
control.

--
Chris Tacke
Co-founder
OpenNETCF.org
Are you using the SDF? Let's do a case study.
Email us at d c s @ o p e n n e t c f . c o m
http://www.opennetcf.org/donate
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top