Good day!
There are 2 forms. When you click on the button of the first form, form2 appears at the second border
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
CenterToScreen()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim frm1Width As Integer = Width
Dim frm1Top As Integer = Top
Dim frm1Left As Integer = Left
Dim delta As Integer = 485
Form2.Show()
Form2.Top = frm1Top
Form2.Left = frm1Left - frm1Width + delta
End Sub
In form2 there is a ban on moving beyond the heading
Protected Overrides Sub WndProc(ByRef message As Message)
Const WM_SYSCOMMAND As Integer = &H112
Const SC_MOVE As Integer = &HF010
Select Case message.Msg
Case WM_SYSCOMMAND
Dim command As Integer = message.WParam.ToInt32() And &HFFF0
If command = SC_MOVE Then
Return
End If
End Select
MyBase.WndProc(message)
End Sub
Tell me how to make it so that it would be possible to move both forms beyond the header of form 1?