I haven't worked with Windows Media Player and don't even have a good idea as to what it is. Therefore, anything I say may be utterly irrelevant.
Oddly, just in the last week I had cause to write a function to create pictureboxes dynamically. The handlers are relatively few, and the properties are equally meager, but it suited my needs. Here's what the function looked like:
All the pictureboxes created like this used the same event handlers for drag and drop functionality.Code:Private Function CreatePB(ByVal top As Integer, ByVal left As Integer, ByVal height As Integer, ByVal width As Integer, ByVal name As String) As PictureBox Dim pb = New PictureBox pb.Name = name pb.Top = top pb.Left = left pb.Width = width pb.Height = height pb.AllowDrop = True pb.BackColor = Color.LightGray pb.SizeMode = PictureBoxSizeMode.StretchImage AddHandler pb.MouseDown, AddressOf pbMouseDown AddHandler pb.DragDrop, AddressOf pbDragDrop AddHandler pb.DragEnter, AddressOf pbDragEnter Return pb End Function
One thing to keep in mind is that you would want to cap the maximum number of picture box controls, or you will have them all over the place, which will become a nightmare.






Reply With Quote