Moving Event

Applies to:  Subclasser object, PowerForm control
See also:  Moved Event, Resizing Event, Resized Event

Occurs when the window subclassed by a Subclasser object or PowerForm control is being moved by the user.

Syntax:

Private Sub object_Moving(NewLeft As Long, NewTop As Long)

The Moving event syntax has these parts:

Part Description
object The name of an object in the Applies to list.  If object is a SubClasser object, then the object must be declared using WithEvents.
NewLeft The distance, in pixels, from the left edge of the screen to the left edge of the dragging rectangle.
NewTop The distance, in pixels, from the top edge of the screen to the top edge of the dragging rectangle.

Remarks:

The Moving event is only raised when the window is being manually moved.  The Moving event is not raised if the window is moved by code (eg by calling the form's Move method).

Moving events are raised repeatedly, whilst the user drags the window by its title bar.  When the user releases the mouse button, a Moved event is raised. 

The values for NewLeft and NewTop can be modified in response to the Moving event, to prevent the user from moving the window into a particular area.

 

Home

Copyright and Disclaimer