|
-
Mar 31st, 2004, 11:01 PM
#1
Thread Starter
Member
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.
-
Apr 1st, 2004, 03:14 AM
#2
Frenzied Member
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
-
Apr 1st, 2004, 06:10 PM
#3
Thread Starter
Member
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'.
-
Apr 1st, 2004, 09:42 PM
#4
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|