Results 1 to 4 of 4

Thread: Control.Move event on Form.Move?

  1. #1

    Thread Starter
    Member
    Join Date
    May 2003
    Posts
    58

    Control.Move event on Form.Move?

    Hi,

    is there a way to detect if the control moves in screen? i need to know if a control moves when its location changed (which is easy) and when it moves because we move the parent form (which I cant figure out). One condition, no code on parent form's move/layout event, basically do nothing with parent form's event.

    Thanks.

  2. #2
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    The control location is relative to its container, so you cant check its new location as an indicator of moving if the container moves. However you can simply fire the desired event both with the control move and its container move.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  3. #3

    Thread Starter
    Member
    Join Date
    May 2003
    Posts
    58
    I thought of that way, but imagine if a control is contained within a container which is contained within another container, and it could be many levels and finally reach the parent form. so, adding custom event handler to move event of each of those isn't really a good thing to happen.

    I have also thought of another way, by using timer but that is not really accurate. the movement need to be detected even a single pixel in real time.

    by the way, thanks for your reply, i really appreciate it. there might be no other ways to achieve this except use move event of each related 'controls'.

  4. #4
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    Even if your control is in a hierarchy of controls you can easily add handler to their move event on form initialization or other desired event by using a recursive loop.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

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