Back buffering with GDI and System.Drawing.Graphics

This is a discussion on Back buffering with GDI and System.Drawing.Graphics within the C# Programming forums, part of the General Programming Boards category; Greetings! I'm doing a simple game in C# where I'd like to use back buffering with GDI and System.Drawing.Graphics. I ...

  1. #1
    Registered Viking
    Join Date
    Aug 2006
    Location
    Norway
    Posts
    19

    Question Back buffering with GDI and System.Drawing.Graphics

    Greetings!

    I'm doing a simple game in C# where I'd like to use back buffering with GDI and System.Drawing.Graphics.

    I get the Graphics object from Control.CreateGraphics():
    Code:
    Graphics myGFX = myControl.CreateGraphics()
    The thing I'd like to do is, instead of retrieving a Graphics from myControl.CreateGraphics(),
    I'd like to create a new Graphics object
    Code:
    Graphics myGFX = new Graphics(...);
    Then draw to myGFX, and when done drawing, I'd like to SET the graphics of myControl = myGFX. To reduce flickering.

    Code:
    myControl.Graphics = myGFX; /* I know this don't work but that's want I want to accomplish... */
    Is there a way to accomplish this?
    Thanks!
    Last edited by MisterT; 09-18-2006 at 12:13 PM.

  2. #2
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,399
    Look into the CopyFromScreen method. I'll admit that I have no idea except for what these two links had to say about it:
    http://msdn2.microsoft.com/en-us/library/db8dsek8.aspx
    http://www.vbforums.com/showthread.p...61394&t=396433
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Windows GDI vs. Java Graphics
    By Perspective in forum Windows Programming
    Replies: 7
    Last Post: 05-07-2007, 11:05 AM
  2. purpose of stream buffering operations?
    By darsunt in forum C Programming
    Replies: 2
    Last Post: 08-29-2006, 11:29 AM
  3. GDI object lifetime and C++ object lifetime
    By VirtualAce in forum Windows Programming
    Replies: 4
    Last Post: 06-16-2006, 06:26 AM
  4. "if you love someone" :D
    By Carlos in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 10-02-2003, 02:10 AM
  5. Some woman back ended my car today, and back hurts
    By Terrance in forum A Brief History of Cprogramming.com
    Replies: 19
    Last Post: 08-20-2003, 01:42 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21