Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Flicker

Flicker

Scheduled Pinned Locked Moved C#
questiongame-devtutorial
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    Umair Ahmad khan
    wrote on last edited by
    #1

    how can i remove flicker from my program .. i am trying to make a simple game of tettris (don't know how to spell it correctly). i have to move a shape from top to bottom so my control is doing this for me .. logic i m using is simple ( i think it is) i m using paint function of my control just to fill a perticular block whose value is 1 and and empty whose value is 0 so i need to call paint function after every some time. but Invalidate function is creating flicker. is there any other way i can use or i i can paint some shapes constantly without using paint function ?? i have tried to use some other my own written function but they are not working until i call 'em from paint function of my control what should i do..

    I J 2 Replies Last reply
    0
    • U Umair Ahmad khan

      how can i remove flicker from my program .. i am trying to make a simple game of tettris (don't know how to spell it correctly). i have to move a shape from top to bottom so my control is doing this for me .. logic i m using is simple ( i think it is) i m using paint function of my control just to fill a perticular block whose value is 1 and and empty whose value is 0 so i need to call paint function after every some time. but Invalidate function is creating flicker. is there any other way i can use or i i can paint some shapes constantly without using paint function ?? i have tried to use some other my own written function but they are not working until i call 'em from paint function of my control what should i do..

      I Offline
      I Offline
      Ian Darling
      wrote on last edited by
      #2

      Look up "Double Buffering".


      Ian Darling The world is a thing of utter inordinate complexity ... that such complexity can arise ... out of such simplicity ... is the most fabulous extraordinary idea ... once you get some kind of inkling of how that might have happened - it's just wonderful ... the opportunity to spend 70 or 80 years of your life in such a universe is time well spent as far as I am concerned - Douglas Adams

      1 Reply Last reply
      0
      • U Umair Ahmad khan

        how can i remove flicker from my program .. i am trying to make a simple game of tettris (don't know how to spell it correctly). i have to move a shape from top to bottom so my control is doing this for me .. logic i m using is simple ( i think it is) i m using paint function of my control just to fill a perticular block whose value is 1 and and empty whose value is 0 so i need to call paint function after every some time. but Invalidate function is creating flicker. is there any other way i can use or i i can paint some shapes constantly without using paint function ?? i have tried to use some other my own written function but they are not working until i call 'em from paint function of my control what should i do..

        J Offline
        J Offline
        Judah Gabriel Himango
        wrote on last edited by
        #3

        Search Codeproject or the web for System.Windows.Forms.ControlStyles.DoubleBuffer, it will get rid of the 'flashing'/flicker when you draw to a windows form.

        Tech, life, family, faith: Give me a visit. I'm currently blogging about: Conversation With a Muslim Judah Himango

        M 1 Reply Last reply
        0
        • J Judah Gabriel Himango

          Search Codeproject or the web for System.Windows.Forms.ControlStyles.DoubleBuffer, it will get rid of the 'flashing'/flicker when you draw to a windows form.

          Tech, life, family, faith: Give me a visit. I'm currently blogging about: Conversation With a Muslim Judah Himango

          M Offline
          M Offline
          Mike Kitchen
          wrote on last edited by
          #4

          Add these 3 lines to your form constructor // Enable Double Buffering to remove flicker this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.DoubleBuffer, true); Hope this helps Publicjoe C# Tutorial at http://www.publicjoe.f9.co.uk/csharp/tut.html C# Ebook at http://www.publicjoe.f9.co.uk/csharp/samples/ebook.html VB Tutorial at http://www.publicjoe.f9.co.uk/vbnet/vbnet.html VB Ebook at http://www.publicjoe.f9.co.uk/vbnet/samples/ebook.html Mirrors at http://dowhileloop.com/publicjoe/ and http://publicjoe.dowhileloop.com

          J 1 Reply Last reply
          0
          • M Mike Kitchen

            Add these 3 lines to your form constructor // Enable Double Buffering to remove flicker this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.DoubleBuffer, true); Hope this helps Publicjoe C# Tutorial at http://www.publicjoe.f9.co.uk/csharp/tut.html C# Ebook at http://www.publicjoe.f9.co.uk/csharp/samples/ebook.html VB Tutorial at http://www.publicjoe.f9.co.uk/vbnet/vbnet.html VB Ebook at http://www.publicjoe.f9.co.uk/vbnet/samples/ebook.html Mirrors at http://dowhileloop.com/publicjoe/ and http://publicjoe.dowhileloop.com

            J Offline
            J Offline
            Judah Gabriel Himango
            wrote on last edited by
            #5

            Or better yet, a single line, with the flags OR'd together: this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true);

            Tech, life, family, faith: Give me a visit. I'm currently blogging about: Conversation With a Muslim Judah Himango

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups