Hello. I have read the questions you have posted and what you are trying to do is a rather big chunk to bite on if you are not clear what you are doing.
However what you want to do can be accomplished but you have to realize that it is pretty tough if you are not versatile at this.
There was a piece of code posted in an answer to one of your other questions and i just made some additions to it. This code does what you want but if you want those forms to be rich with controls there will be a lot more of coding ahead of you to do. A simple workaround for what you are trying to do just doesn't exist.
Create a form and create a button on the form named Button1 and insert this into your code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim FormX As New Form
Dim ButtonX As New Button
ButtonX.Location = New Point(100, 100)
ButtonX.Text = "My Button"
FormX.Name = "SomeForm"
AddHandler FormX.Load, AddressOf FormXLoadHandlerFunction
AddHandler ButtonX.MouseDown, AddressOf ButtonXMouseDownHandlerFunction
AddHandler ButtonX.MouseClick, AddressOf ButtonXMouseClickHandlerFunction
FormX.Controls.Add(ButtonX)
FormX.Show()
End Sub
Public Sub FormXLoadHandlerFunction(ByVal sender As System.Object, ByVal e As System.EventArgs)
MsgBox(sender.Name + " was loaded.")
End Sub
Public Sub ButtonXMouseDownHandlerFunction(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs)
If Control.MouseButtons = Windows.Forms.MouseButtons.Right Then
Dim mousepos As New Point(MousePosition)
Dim deviation As New Point(mousepos.X - sender.Location.X, mousepos.Y - sender.Location.Y)
Do
sender.Location = MousePosition - deviation
Application.DoEvents()
Loop While MouseButtons = Windows.Forms.MouseButtons.Right
End If
If Control.MouseButtons = Windows.Forms.MouseButtons.Left Then
MsgBox("Button on a runtime created form was clicked")
End If
End Sub