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. forms loading events!!!

forms loading events!!!

Scheduled Pinned Locked Moved C#
designwinformshelp
9 Posts 6 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.
  • F Offline
    F Offline
    faheemnadeem
    wrote on last edited by
    #1

    Hi, i want to ask whether there are any events for windows forms which will help me detect if the form is fully loaded. i.e that the UI is completed loaded and is visibly to the user, so that i can perform some actions after that. I intend to display some animations only when the user interface is completely loaded and visibly to the user. Using the form_load events does not help as already everything will be loaded when the form appears. i wish to do some action after some time. Anything except timers.

    C A L 3 Replies Last reply
    0
    • F faheemnadeem

      Hi, i want to ask whether there are any events for windows forms which will help me detect if the form is fully loaded. i.e that the UI is completed loaded and is visibly to the user, so that i can perform some actions after that. I intend to display some animations only when the user interface is completely loaded and visibly to the user. Using the form_load events does not help as already everything will be loaded when the form appears. i wish to do some action after some time. Anything except timers.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      There is a visible changed event, I think, but the loaded event has always worked for me.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      F 1 Reply Last reply
      0
      • C Christian Graus

        There is a visible changed event, I think, but the loaded event has always worked for me.

        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

        F Offline
        F Offline
        faheemnadeem
        wrote on last edited by
        #3

        na!!! u mis understood me. I just want to do something once the UI is fully loaded and is displayed. I will try the visible changed event. but still there should be some kind of indication which could tell me if the user interface load is complete and it is displayed fully onscreen

        1 Reply Last reply
        0
        • F faheemnadeem

          Hi, i want to ask whether there are any events for windows forms which will help me detect if the form is fully loaded. i.e that the UI is completed loaded and is visibly to the user, so that i can perform some actions after that. I intend to display some animations only when the user interface is completely loaded and visibly to the user. Using the form_load events does not help as already everything will be loaded when the form appears. i wish to do some action after some time. Anything except timers.

          A Offline
          A Offline
          Alan N
          wrote on last edited by
          #4

          Hi, Take a look at the Application.Idle event which is raised whenever the windows message queue is empty. The first time this happens is when the the form is fully displayed. Detach the handler within the handler if no more notifications are needed. Hope that makes sense!

          private void Application\_Idle(object sender, EventArgs e) {
            Application.Idle -= new EventHandler(this.Application\_Idle);
            // do stuff here
          }
          

          Alan.

          M 1 Reply Last reply
          0
          • A Alan N

            Hi, Take a look at the Application.Idle event which is raised whenever the windows message queue is empty. The first time this happens is when the the form is fully displayed. Detach the handler within the handler if no more notifications are needed. Hope that makes sense!

            private void Application\_Idle(object sender, EventArgs e) {
              Application.Idle -= new EventHandler(this.Application\_Idle);
              // do stuff here
            }
            

            Alan.

            M Offline
            M Offline
            Mycroft Holmes
            wrote on last edited by
            #5

            Alan N wrote:

            whenever the windows message queue is empty

            Does this state always get hit when the form has completed, can the user start filling the queue by banging on a button or activating another event before this state can be reached.

            Never underestimate the power of human stupidity RAH

            A D 2 Replies Last reply
            0
            • F faheemnadeem

              Hi, i want to ask whether there are any events for windows forms which will help me detect if the form is fully loaded. i.e that the UI is completed loaded and is visibly to the user, so that i can perform some actions after that. I intend to display some animations only when the user interface is completely loaded and visibly to the user. Using the form_load events does not help as already everything will be loaded when the form appears. i wish to do some action after some time. Anything except timers.

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

              Hi, Have a look at the Form.Shown event. Is it too hard to look over the list of available events? do you really want to wait one hour or so for an answer? :)

              Luc Pattyn


              I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


              Local announcement (Antwerp region): Lange Wapper? Neen!


              F 1 Reply Last reply
              0
              • M Mycroft Holmes

                Alan N wrote:

                whenever the windows message queue is empty

                Does this state always get hit when the form has completed, can the user start filling the queue by banging on a button or activating another event before this state can be reached.

                Never underestimate the power of human stupidity RAH

                A Offline
                A Offline
                Alan N
                wrote on last edited by
                #7

                Hi, Good point, I was assuming a hypothetical well behaved and patient user, which is probably unrealistic. Alan.

                1 Reply Last reply
                0
                • M Mycroft Holmes

                  Alan N wrote:

                  whenever the windows message queue is empty

                  Does this state always get hit when the form has completed, can the user start filling the queue by banging on a button or activating another event before this state can be reached.

                  Never underestimate the power of human stupidity RAH

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

                  It cannot be relied upon to do what you want. Idle only fires when the message queue for the entire application is empty, not when any one form is idle. The VisibleChanged event of the form is about as close as your going to get. Just be sure to check the Visible property of the form so you're not trying to do whatever you need to when the form is no longer visible or gets covered up. You're also going to have to make sure you set a flag to know that you've started whatever work you need. The VisibleChanged event will also fire if anotehr form obscures your form and when the form is no longer obscured.

                  A guide to posting questions on CodeProject[^]
                  Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                       2006, 2007, 2008
                  But no longer in 2009...

                  1 Reply Last reply
                  0
                  • L Luc Pattyn

                    Hi, Have a look at the Form.Shown event. Is it too hard to look over the list of available events? do you really want to wait one hour or so for an answer? :)

                    Luc Pattyn


                    I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


                    Local announcement (Antwerp region): Lange Wapper? Neen!


                    F Offline
                    F Offline
                    faheemnadeem
                    wrote on last edited by
                    #9

                    :P No dude its not hard, but experimenting with these events takes time and i don't have much for one thing. So y not ask the people who have already experimented on it.

                    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