I have the main Form called frmMotherShip and I want to load, let's say, 40 other Forms as an array. The names of the other Forms will be frmSlaveShip(0), frmSlaveShip(1),.........frmSlaveShip(39). Each of these other Forms will have the same code and each will have a different picture in a Picturebox. So, for example frmSlaveShip(0) will have the following code:
Code:
Private Sub Form_Load()
Dim WindowRegion As Long
SetTopmostWindow Me.hwnd, True
picShip.Picture = LoadPicture(App.Path & "\Ship(0)")
WindowRegion = MakeRegion(picShip)
SetWindowRgn Me.hwnd, WindowRegion, True
End Sub
Private Sub picShip_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then
End If
End Sub
Private Sub picShip_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Static lx As Single, ly As Single
If Button = vbLeftButton Then
Left = Left + ScaleX((x - lx), picShip.ScaleMode, vbTwips)
Top = Top + ScaleY((y - ly), picShip.ScaleMode, vbTwips)
Else
lx = x: ly = y
End If
End Sub
Private Sub picShip_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then
End If
End Sub
Now the only difference between each of these Forms will be this code line:
Code:
picShip.Picture = LoadPicture(App.Path & "\Ship(0)")
where the name of the bitmap to load will be Ship(1), Ship(2),......Ship(39) for each Form in the array.
Is it possible to load these Forms using code or do I have to make each one of them, load the correct picture and make sure the LoadPicture code line is correct