[RESOLVED] abou move and not move events
i'm using the VB6 and i'm creating a control for put the Move and NotMove events, but i know that theres a error in my code... can anyone help me?
heres the control code:
Code:
Option Explicit
Event Move(PosX As Long, PosY As Long)
Event NotMove(PosX As Long, PosY As Long)
Dim OldPosX As Long
Dim OldPosY As Long
Private Sub Timer1_Timer()
'testing if the usercontrol is moving or not
If UserControl.CurrentX <> OldPosX Or UserControl.CurrentY <> OldPosY Then
OldPosX = UserControl.CurrentX
OldPosY = UserControl.CurrentY
RaiseEvent Move(OldPosX, OldPosY)
Else
RaiseEvent NotMove(OldPosX, OldPosY)
End If
End Sub
Private Sub UserControl_Initialize()
'receving the actual position of the usercontrol in form
OldPosX = UserControl.CurrentX
OldPosY = UserControl.CurrentY
UserControl.MaskColor = UserControl.BackColor
UserControl.MaskPicture = UserControl.Image
End Sub
i tested the currentx and currenty but i'm recive 0(zero), why?
thanks
Re: [RESOLVED] abou move and not move events
This is marked resolved but with no posted resolution.
Did you resolve your issue?
If so, please post what you did as it may help someone else with the same or similiar issue.
Thanks. :)
Re: [RESOLVED] abou move and not move events
Quote:
Originally Posted by Hack
This is marked resolved but with no posted resolution.
Did you resolve your issue?
If so, please post what you did as it may help someone else with the same or similiar issue.
Thanks. :)
i'm sorry... you have right...
i just build 2 variables: lngPosX and lngPosY, both type long...
then i read the variables in show usercontrol event using the Extender.left and Extender.top lines:
Code:
lngPosX=Extender.left
lngPosY=Extender.top
then i put them in a timer control to see the actual position of a usercontrol in form:
Code:
If Extender.Left <> lngOldPosX Or Extender.Top <> lngOldPosY Then
lngOldPosX = Extender.Left
lngOldPosY = Extender.Top
RaiseEvent Move(lngOldPosX, lngOldPosY)
Else
RaiseEvent NotMove(lngOldPosX, lngOldPosY)
End If
thanks