When the volume of data is large, the drawing may take several seconds or longer, and sometimes flicker, in order to solve these problems, you can use double buffering technology to draw graphs.
Double buffering creates an object in memory that is consistent with the screen drawing area, drawing the graphic to the object in memory, and then copying the graphic on the object to the screen at once, which can greatly speed up the drawing. The double buffering implementation process is as follows:
1, in memory to create a consistent canvas with the buffer
Bufferbmp=new Graphics::tbitmap ();
Bufferbmp->canvas->handle=createcompatibledc (Canvas->handle);
bufferbmp->width=width;
bufferbmp->height=height;
2, in the buffer paint
bufferbmp->canvas->brush->color=clbtnface;
Bufferbmp->canvas->fillrect (Rect (0,0,width,height));
Bufferbmp->canvas->moveto (...);
..............................
3. Copy the buffer bitmap to the current canvas
BitBlt (canvas->handle,0,0,width,height,bufferbmp->canvas->handle,0,0,srccopy);
4, free memory buffer
Delete bufferbmp;