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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Timer

Timer

Scheduled Pinned Locked Moved C#
graphicstutorial
18 Posts 6 Posters 1 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.
  • B bar3000

    I should have mentioned the fact that the picturebox may change and it does not necessarily change it's x coordinate by a constant value. It may also changes its y value.

    M Offline
    M Offline
    musefan
    wrote on last edited by
    #5

    then how does it change? what decides which value changes if any?

    If only MySelf.Visible was more than just a getter... A person can produce over 5 times there own body weight in excrement each year... please re-read your questions before posting

    1 Reply Last reply
    0
    • B bar3000

      I should have mentioned the fact that the picturebox may change and it does not necessarily change it's x coordinate by a constant value. It may also changes its y value.

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #6

      bar3000 wrote:

      and it does not necessarily change it's x coordinate by a constant value. It may also changes its y value.

      So?? The concept is still the same. You're just chaning the math that you have to do inside the Tick event.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008

      1 Reply Last reply
      0
      • P PIEBALDconsult

        I'd use a System.Timers.Timer, but that's just me.

        B Offline
        B Offline
        bar3000
        wrote on last edited by
        #7

        Intresting, but I'd be delighted if you could give me some more detailed code because I am a real noob in C#. Thank you:)

        P 1 Reply Last reply
        0
        • B bar3000

          Intresting, but I'd be delighted if you could give me some more detailed code because I am a real noob in C#. Thank you:)

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #8

          bar3000 wrote:

          I am a real noob in C#.

          And as such, I would be doing you a disservice if I provided you with code; read the documentation and experiment, you'll learn more.

          1 Reply Last reply
          0
          • P PIEBALDconsult

            I'd use a System.Timers.Timer, but that's just me.

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #9

            I would definitely use a Windows.Forms.Timer since that one ticks on the GUI thread, hence the tick handler can manipulate all Controls directly without needing any Invoke stuff. :)

            Luc Pattyn [Forum Guidelines] [My Articles]


            - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets


            modified on Sunday, June 12, 2011 8:20 AM

            1 Reply Last reply
            0
            • P PIEBALDconsult

              I'd use a System.Timers.Timer, but that's just me.

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #10

              Yeah, but since he's so new at this, I didn't want to throw the control cross-threading problem into his already existant confusion.

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007, 2008

              P 1 Reply Last reply
              0
              • D Dave Kreskowiak

                Yeah, but since he's so new at this, I didn't want to throw the control cross-threading problem into his already existant confusion.

                A guide to posting questions on CodeProject[^]
                Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                     2006, 2007, 2008

                P Offline
                P Offline
                PIEBALDconsult
                wrote on last edited by
                #11

                I would. (Where's the evil grin emoticon?)

                D 1 Reply Last reply
                0
                • P PIEBALDconsult

                  I would. (Where's the evil grin emoticon?)

                  D Offline
                  D Offline
                  Dave Kreskowiak
                  wrote on last edited by
                  #12

                  :laugh: :thumbsup:

                  A guide to posting questions on CodeProject[^]
                  Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                       2006, 2007, 2008

                  B 1 Reply Last reply
                  0
                  • D Dave Kreskowiak

                    :laugh: :thumbsup:

                    A guide to posting questions on CodeProject[^]
                    Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                         2006, 2007, 2008

                    B Offline
                    B Offline
                    bar3000
                    wrote on last edited by
                    #13

                    I lost you guys... But I'll try to find some book about it. Thanks anyway:)

                    L 1 Reply Last reply
                    0
                    • B bar3000

                      I lost you guys... But I'll try to find some book about it. Thanks anyway:)

                      L Offline
                      L Offline
                      Luc Pattyn
                      wrote on last edited by
                      #14

                      Yep. use a Windows.Forms.Timer, but before you do read up on everything you plan on using. A book is always a good start. :)

                      Luc Pattyn [Forum Guidelines] [My Articles]


                      - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets


                      modified on Sunday, June 12, 2011 8:21 AM

                      1 Reply Last reply
                      0
                      • B bar3000

                        Hi, I would like to excute a command after a certain period of time, for instance 1 sec. For Example: pictureBox78.Location = new System.Drawing.Point(460, 360); 1 sec interval pictureBox78.Location = new System.Drawing.Point(560, 360); 1 sec interval pictureBox78.Location = new System.Drawing.Point(660, 360); 1 sec interval pictureBox78.Location = new System.Drawing.Point(760, 360); and so on... Thanks in Advance:)

                        L Offline
                        L Offline
                        Leonardo Muzzi
                        wrote on last edited by
                        #15

                        If you just want an interval, System.Threading.Thread.Sleep() should do the job.

                        Regards, Leonardo Muzzi

                        D 1 Reply Last reply
                        0
                        • L Leonardo Muzzi

                          If you just want an interval, System.Threading.Thread.Sleep() should do the job.

                          Regards, Leonardo Muzzi

                          D Offline
                          D Offline
                          Dave Kreskowiak
                          wrote on last edited by
                          #16

                          Yeah, but the change in location requires a WM_PAINT message to go through the pump, which youre suggestion just halted for x milliseconds, preventing the message from being processed and the form being repainted.

                          A guide to posting questions on CodeProject[^]
                          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                               2006, 2007, 2008

                          L 1 Reply Last reply
                          0
                          • D Dave Kreskowiak

                            Yeah, but the change in location requires a WM_PAINT message to go through the pump, which youre suggestion just halted for x milliseconds, preventing the message from being processed and the form being repainted.

                            A guide to posting questions on CodeProject[^]
                            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                                 2006, 2007, 2008

                            L Offline
                            L Offline
                            Leonardo Muzzi
                            wrote on last edited by
                            #17

                            Didn't know that. Maybe you have a command for refreshing the form?

                            Regards, Leonardo Muzzi

                            D 1 Reply Last reply
                            0
                            • L Leonardo Muzzi

                              Didn't know that. Maybe you have a command for refreshing the form?

                              Regards, Leonardo Muzzi

                              D Offline
                              D Offline
                              Dave Kreskowiak
                              wrote on last edited by
                              #18

                              Yeah, it's Invalidate, which generates a new WM_PAINT event for the entire form. Same problem. If the UI thread is blocked (sleep), the form doesn't get painted.

                              A guide to posting questions on CodeProject[^]
                              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                                   2006, 2007, 2008

                              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