You certainly need to use double buffering. The only one method to accelerate things is to calculate some subset of the points of your window area, only those really touched by your most recent change in data, and call
InvalidateRect
or
InvalidateRegion
. You can combine any number of different region, they will be ORed together and the Windows message handling mechanism (very special for
WM_PAINT
) will, to some extent, optimize out redundant redrawing. Please see:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd145002%28v=vs.85%29.aspx[
^],
http://msdn.microsoft.com/en-us/library/aa769105%28v=vs.85%29.ASPX[
^].
However, this measure may have limited effect if the invalidate areas are not much smaller then the whole scene.
By they way, you should not use anything like "refresh", you should only use "invalidate" methods. If you did something except invalidation, it could also affect your performance badly.
If my advice does not help much, you should critically review your code and optimize it. A good code profiler could help. If this is not enough, perhaps your graphics is too rich and your performance requirements are too tough, for the relatively slow GDI+. Then you should think about using DirectX instead:
http://en.wikipedia.org/wiki/DirectX[
^],
http://www.dmoz.org/Computers/Programming/Libraries/DirectX/[
^],
http://www.microsoft.com/en-us/download/details.aspx?id=6812[
^],
http://msdn.microsoft.com/en-us/library/windows/apps/jj554502.aspx[
^].
See also:
http://msdn.microsoft.com/library/windows/apps/hh452744.aspx[
^].
—SA