how to prevent image flickering?
Hi all,
I have a picturebox (with scrollbars) in my form.
I use the following code:
---------
Graphics g = picBox.CreateGraphics();
g.DrawImage(picBox.Image, new Rectangle(0, 0, picPolicy.ClientSize.Width,
picPolicy.ClientSize.Height),
new Rectangle(hScrollBar.Value, vScrollBar.Value,
picPolicy.ClientSize.Width,
picPolicy.ClientSize.Height),
GraphicsUnit.Pixel);
//draws a rectangle to highlight a specified area
g.FillRectangle(brush, rect.Left - hScrollBar.Value, rect.Top - vScrollBar.Value, (rect.Right - rect.Left), (rect.Botom - rect.Top));
picBox.Update();
}
---------
When I'm scrolling the drawn image it flickers too match.
Is there are any way to prevent flickering?
Thanks.
|