Private Sub Form1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick Dim F As New Form2 F.StartPosition = FormStartPosition.Manual F.Left = Cursor.Position.X - F.Width F.Top = Cursor.Position.Y - F.Height F.Show() End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim pt As Point = Windows.Forms.Cursor.Position
Dim size As Size = Me.Size
Me.Location = New Point(pt.X - size.Width, pt.Y - size.Height)
End Sub
Making a window appear at the mouse
Tej51078
Richard: Thanks, it works!
Thank you all for your time.
Zjivago
Dim F As New Form2
F.StartPosition = FormStartPosition.Manual
F.Left = Cursor.Position.X - F.Width
F.Top = Cursor.Position.Y - F.Height
F.Show()
End Sub
Lisa Shipley
Ok .. is this what you were after
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim pt As Point = Windows.Forms.Cursor.Position Dim size As Size = Me.Size Me.Location = New Point(pt.X - size.Width, pt.Y - size.Height) End SubRichard
Kaleb
It works for me.
What particular aspect "doesn't work"
sfjari
Can you advise if the form you want to show is an mdi child form, or a top level form
Thanks
Richard
pimmy21
Dick: It's a top level form.