Results 1 to 7 of 7

Thread: .NET's BUILT-IN DOUBLE BUFFERING and FASTER GRAPHICS DRAWING in GDI+

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2002
    Posts
    261

    .NET's BUILT-IN DOUBLE BUFFERING and FASTER GRAPHICS DRAWING in GDI+

    Alright, I've seen many examples from people all over the net trying to mimic double buffering by using Image/bitmap and graphics objects! However, all of those examples are VERY slow and inefficient!!!!!

    Here's the absolute BEST way to do double buffering with the GDI+:

    First, add the following 3 lines into your form's constructor (the New method, where it says "put initialization code here"):

    SetStyle(ControlStyles.AllPaintingInWmPaint, True)
    SetStyle(ControlStyles.DoubleBuffer, True)
    SetStyle(ControlStyles.UserPaint, True)

    Now, draw all of your graphics in the Paint event. They will appear only after the Paint event terminates!


    Finally, as I said, Image and Bitmap objects are slow. Their good for image manipulation, but definately NOT for speed. You'll be very lucky to render them at about 10 FPS (even with a fast computer), and it will take up all of your processing power and much of your RAM. If you need extra speed and more efficient use of system resources, create TextureBrush objects from your Image/Bitmap objects, and use those in your loops in place of the image and bitmap objects, or wherever you need the speed.


    I havn't seen either of these tricks documented very well, and I've seen too many people make futile attempts to mimic them. I hope this helps you all out!
    Last edited by Hu Flung Dung; Mar 9th, 2003 at 11:10 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width