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. showing form from bottom wth timer

showing form from bottom wth timer

Scheduled Pinned Locked Moved C#
help
19 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.
  • V V 0

    I can see several problems: - are the timers started when the button is pressed? What is the interval? - It's possible that you need to send a redraw command on each tick (like update or invalidate or something) - I'm confused the compiler doesn't complain about the flag variable. It's accessed across threads. - why two timers? I believe 1 timer should be able to do the trick ? the simplest way to go on about this IMHO is: - 1 timer. - 1 static boolean (true when button pressed, false when movement was done) - 1 static counter that counts each passing of the the timer_tick handler. - 1 static (final) stopvalue for when the work should stop. in timer_tick you then check counter vs stopvalue (= amount of time), set the flag on false and reset the form, in an if(flag==true) block you can then move the form. this is quick thinking, you can go into the details from there. hope this helps...

    V.
    (MQOTD Rules and previous Solutions )

    E Offline
    E Offline
    eng iris
    wrote on last edited by
    #9

    thanks alot for your hints i will try them my problem is in how make the form come up again after its hidden in the corner after 2 minutes ?

    M V 2 Replies Last reply
    0
    • E eng iris

      thanks alot for your hints i will try them my problem is in how make the form come up again after its hidden in the corner after 2 minutes ?

      V Offline
      V Offline
      V 0
      wrote on last edited by
      #10

      if the goal is to hide the form you should use the Visible property (see here[^]) else you just reset the location of the form. You could keep the initial location in a Point variable and reset it to that when you reset the form.

      V.
      (MQOTD Rules and previous Solutions )

      E 1 Reply Last reply
      0
      • E eng iris

        thanks alot for your hints i will try them my problem is in how make the form come up again after its hidden in the corner after 2 minutes ?

        M Offline
        M Offline
        Midnight Ahri
        wrote on last edited by
        #11

        I've put the comment on where to change the delay. And I changed the interval to 1000 so the tick event execute every 1 second. So you don't have to change the interval anymore.

        E 1 Reply Last reply
        0
        • E eng iris

          it doesnt do the movement up-down an down-up of the form in the corner of the screen

          K Offline
          K Offline
          Kamran Ayati
          wrote on last edited by
          #12

          you must set timer.enabled= true timer.interval =1000 milissecond and in timer event timer copy your code for move for example buton1.left=buton1.left+100;(for x axis) buton1.top=buton1.top+200;(for y axis)

          E 1 Reply Last reply
          0
          • V V 0

            if the goal is to hide the form you should use the Visible property (see here[^]) else you just reset the location of the form. You could keep the initial location in a Point variable and reset it to that when you reset the form.

            V.
            (MQOTD Rules and previous Solutions )

            E Offline
            E Offline
            eng iris
            wrote on last edited by
            #13

            the goal is not hiding the form i want to move it down and after an interval make it move up again as its shown first if i hide data order will be lost " bindingsource.movenext " so i just wan to delay its appearance wth the samem data >>> by move it up and down ,,up and down how can i move it up again after passed time ? hope u got me thank you all again i appreciate

            V 1 Reply Last reply
            0
            • K Kamran Ayati

              you must set timer.enabled= true timer.interval =1000 milissecond and in timer event timer copy your code for move for example buton1.left=buton1.left+100;(for x axis) buton1.top=buton1.top+200;(for y axis)

              E Offline
              E Offline
              eng iris
              wrote on last edited by
              #14

              i didi that still no use :(

              1 Reply Last reply
              0
              • M Midnight Ahri

                I've put the comment on where to change the delay. And I changed the interval to 1000 so the tick event execute every 1 second. So you don't have to change the interval anymore.

                E Offline
                E Offline
                eng iris
                wrote on last edited by
                #15

                yessssssss that wat i want thanks alot midnight thanks all :)

                E 1 Reply Last reply
                0
                • E eng iris

                  the goal is not hiding the form i want to move it down and after an interval make it move up again as its shown first if i hide data order will be lost " bindingsource.movenext " so i just wan to delay its appearance wth the samem data >>> by move it up and down ,,up and down how can i move it up again after passed time ? hope u got me thank you all again i appreciate

                  V Offline
                  V Offline
                  V 0
                  wrote on last edited by
                  #16

                  I answered it already. To move the form you need to change the location property. Possibly you'll need to force a redraw by calling invalidate or refresh or update or something. If you want to set it back after an amount of time you need to store the original location before moving. Moving is with X-Y coordinates (per pixel) where X is moving from left to right and Y from top to bottom. So on a 1024x768 screen the top-left corner is 0,0 and the bottom-right corner 1024,768. This should provide you with enough information to get you going.

                  V.
                  (MQOTD Rules and previous Solutions )

                  1 Reply Last reply
                  0
                  • E eng iris

                    yessssssss that wat i want thanks alot midnight thanks all :)

                    E Offline
                    E Offline
                    eng iris
                    wrote on last edited by
                    #17

                    the form is comimg up and then come back down when click a button what if i want the for to come down again after its shown for 1 minutes for example have i add a timer test the i will be gratefull

                    M 1 Reply Last reply
                    0
                    • E eng iris

                      the form is comimg up and then come back down when click a button what if i want the for to come down again after its shown for 1 minutes for example have i add a timer test the i will be gratefull

                      M Offline
                      M Offline
                      Midnight Ahri
                      wrote on last edited by
                      #18

                      yes, you can create a timer that will start when the form is shown or change your code to make it better, less timer.

                      E 1 Reply Last reply
                      0
                      • M Midnight Ahri

                        yes, you can create a timer that will start when the form is shown or change your code to make it better, less timer.

                        E Offline
                        E Offline
                        eng iris
                        wrote on last edited by
                        #19

                        ok i will try it thank u soo much

                        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