Reputation: 37
i have some forms which have a set minimum and maximum resolution to 400,400 so it is always a square and cannot be adjusted using the control box
my main issue is that whenever a new form opens or closes, the forms are always opening diagonally down to the right or up to the left and i want to stop this happening as it looks bad if you keep opening and closing the forms (as you can see the previous forms in the background)
You can reproduce this by creating a new visual basic forms project and creating a button which opens another form, you can see that the new form is not directly over the other form.
with thanks, forp
Upvotes: 0
Views: 166
Reputation: 25057
You can set the location of the new form, for example to put its top-left in the same place as the current form's location:
Private Sub bnShowFormB_Click(sender As Object, e As EventArgs) Handles bnShowFormB.Click
Dim formB As New Form2() With {.StartPosition = FormStartPosition.Manual,
.Location = Me.Location}
formB.Show()
End Sub
Upvotes: 1
Reputation: 18
in the forms window properties, there is a property named StartPosition
. This you have to set it to Manual
, and that's it.
Form1.StartPosition = System.Windows.Forms.FormStartPosition.Manual
Upvotes: 0