Hi
How To Make This Faster
Private Sub MonMove()
For A = 0 To (Cnt - 1)
MyControlArray(A).Location = New Point(MyControlArray(A).Left _
- 1,MyControlArray(A).Top)
Next
End Sub
first i make A Hundred of PictureBox Later
I use Array
How To Make it Faster ,When It Appear More than 20 Box
It Will BeCome Slower And Slower Later It Move Each Box You Can See IT Move Each Box
My COde So Slow
When TimerTick Will Call MonMove
Timer InterVal is 10
Another Class BulletArray.vb
Array Code
Public Class BulletArray
Inherits System.Collections.CollectionBase
Private ReadOnly HostForm As System.Windows.Forms.Form
Public Sub New(ByVal host As System.Windows.Forms.Form)
HostForm = host
Me.AddNewBullet()
End Sub
Public Function AddNewbullet() As System.Windows.Forms.PictureBox
Dim aPictureBox As New System.Windows.Forms.PictureBox()
Me.List.Add(aPictureBox)
HostForm.Controls.Add(aPictureBox)
aPictureBox.Top = Count * 25
aPictureBox.Left = 100
aPictureBox.Tag = Me.Count
aPictureBox.BackColor = Color.Black
aPictureBox.Size = New Size(10, 5)
AddHandler aPictureBox.Click, AddressOf ClickHandler
Return aPictureBox
End Function
Default Public ReadOnly Property Item(ByVal Index As Integer) As _
System.Windows.Forms.PictureBox
Get
Return CType(Me.List.Item(Index), System.Windows.Forms.PictureBox)
End Get
End Property
Public Sub Remove()
If Me.Count > 0 Then
HostForm.Controls.Remove(Me(Me.Count - 1))
Me.List.RemoveAt(Me.Count - 1)
End If
End Sub
Public Sub ClickHandler(ByVal sender As Object, ByVal e As _
System.EventArgs)
MessageBox.Show("you have clicked button " & CType(CType(sender, _
System.Windows.Forms.PictureBox).Tag, String))
End Sub
End Class
This Code Change From MSDN ButtonArrayProject
Thanks For Help