I am using BufferedGraphics for the Form_Paint function. Its draw my required graphics, but its too slow. Please give me hints to solve this problem or offer me any other painting technique for a quick response.
BufferedGraphicsContext currentContext;
BufferedGraphics myBuffer;
currentContext = BufferedGraphicsManager.Current;
myBuffer = currentContext.Allocate(this.CreateGraphics(),
this.DisplayRectangle);
myBuffer.Graphics.DrawImage(new Bitmap("C:\\Documents and Settings\\Administrator\\My Documents\\My Pictures\\Pics\\Pic.jpg"), 0, 0);
myBuffer.Graphics.DrawEllipse(Pens.Blue, 5, 90, 10, 10);
myBuffer.Graphics.DrawRectangle(Pens.Gold, 0, 7, 500, 500);
myBuffer.Graphics.DrawLine(Pens.Chartreuse, 0, 0, 800, 800);
myBuffer.Render();
This is a small example of BufferedGraphics, which works fine, but when load increases slow down.
source
share