Results 1 to 2 of 2

Thread: pressing ALT or TAB caused redraw?

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2011
    Posts
    1

    pressing ALT or TAB caused redraw?

    Hello everyone,

    I'm trying to do a little remake of the old game Achtung! Die Kurve, which is a snake-like game, but with multiple players trying to corner eachother until one remains. Don't play it, it's way to addictive, thats why i'm doing the remake now, I want to play it with up to 8 players instead of 6.

    Now here's the problem: to draw the snake, i just use the GDI+ and make it draw a 3x3 rectangle on the form background. It works fine, until you resize or minimize/maximize or something like that, which causes a complete repaint of the form. This is not a problem... but when I press ALT or TAB, the form repaints. And even stranger: it only happens the first time I hit each button. I can make it happen twice by hitting ALT and then TAB or vice versa, after that, nothing.

    I really don't get it, and its driving me crazy. I dont want a game with a splash screen saying 'First hit alt, then tab to start the game. Not at the same time that makes you leave the game.'

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    23,313

    Re: pressing ALT or TAB caused redraw?

    graphics drawn directly onto the form or any drawing surface aren't persistent, as you've found.
    you can do your drawing in the form_paint event + it'll redraw every time the form refreshes, or better still draw to a bitmap + use that as your form's backgroundimage

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