Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

which event goes off when I move a form? 1

Status
Not open for further replies.

Painkiller

Programmer
May 18, 2001
97
NL
Hi all,

I need to register the form.top and form.left positions when the form is moved or repositioned. Does anyone know which event goes off when the form is moved or how I can solve this problem?

Much appreciated

 

i think this is about the only way you can do it in a standard window
Private Sub Timer1_Timer()
Dim x As Integer, y As Integer
x = Form1.Top
y = Form1.Left

End Sub
does your form.borderstyle=0 ?
if yes there is a way
 
Borderstyle = 2 (sizable)

I'm already using a timer to check if the postion has changed. Just wanted to know if there was a sort of event that went of or there was another solution to the problem.

Thanx anyway.


 
my brain was hrad at work to get this
make a new exe and
put a timer on a form
and a command button
then add my code
set timer interval to 10 or something smallwho cares


Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Dim ftop As Integer, fleft As Integer

Private Sub Command1_Click()
Timer1.Enabled = False
MsgBox "Top:" & ftop & " Left:" & fleft
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button = vbLeftButton Then

ReleaseCapture
SendMessage Me.hwnd, &HA1, 2, 0&
Timer1.Enabled = True
End If
End Sub

Private Sub Timer1_Timer()
ftop = Form1.Top
fleft = Form1.Left
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top