2 Forms Advanced
Posted: Sat Aug 14, 2010 5:12 pm
Hi, this is a problem encountered, this problem is not the same as asked by NowAyiN(Click)
The method doesn't work for me.
My ingredients :
1 Menu Item (Check on click = True)
7 Forms to dock
1 Snap-Window (A custom control that has a stronger magnetic force)
1 Master Form
Differences with CNS code :
I used Snap-Window instead of h-w-n-d
I used a custom code to determine where the form is
I have 7 forms to dock
My Snap-Window method works perfectly.
Now, my custom code to determine where the form is :
Status : Rejected
Someone please help me!
The method doesn't work for me.
My ingredients :
1 Menu Item (Check on click = True)
7 Forms to dock
1 Snap-Window (A custom control that has a stronger magnetic force)
1 Master Form
Differences with CNS code :
I used Snap-Window instead of h-w-n-d
I used a custom code to determine where the form is
I have 7 forms to dock
My Snap-Window method works perfectly.
Now, my custom code to determine where the form is :
Code: Select all
And my code to detect the form is docked :
Public Function IsLeftTo(ByVal you As Form, ByVal him As Form)
If you.Left = him.Location.X - 214 Then
If you.Top = him.Top Then
Return True
Else
Return False
End If
End If
End Function
Public Function IsRightTo(ByVal you As Form, ByVal him As Form)
If you.Left = him.Location.X + 218 Then
If you.Top = him.Top Then
Return True
Else
Return False
End If
End If
End Function
Public Function IsTopTo(ByVal you As Form, ByVal him As Form)
If you.Top = him.Location.Y - 133 Then
If you.Width = him.Width Then
If you.Left = him.Left Then
Return True
Else
Return False
End If
End If
End If
End Function
Public Function IsBottomTo(ByVal you As Form, ByVal him As Form)
If you.Top = him.Top + him.Height Then
If you.Left = him.Left Then
If you.Width = him.Width Then
Return True
Else
Return False
End If
End If
End If
End Function
Public Sub SetTop(ByVal you As Form, ByVal him As Form)
you.Top = him.Location.Y - 133
you.Width = him.Width
you.Left = him.Left
End Sub
Public Sub SetBottom(ByVal you As Form, ByVal him As Form)
you.Top = him.Top + him.Height
you.Left = him.Left
you.Width = him.Width
End Sub
Public Sub SetRight(ByVal you As Form, ByVal him As Form)
you.Left = him.Location.X + 218
you.Top = him.Top
End Sub
Public Sub setLeft(ByVal you As Form, ByVal him As Form)
you.Left = him.Location.X - 214
you.Top = him.Top
End Sub
Code: Select all
Hypothesis : if first form is moved, second form that is docked will follow. Private Sub musicbox_Move(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Move
If cs.IsTopTo(Playlist, Me) Then
cs.SetTop(Playlist, Me)
End If
End Sub
Status : Rejected
Someone please help me!