hi guys
here is the code I took from msdn.microsoft which is implementing control array, I have about 1500 or 3000 label in my project which only 5 to 10 of them will display at a time and they will just in and out of screen (implementing sort of timeline such as premiere) and in VB6 it was not PERFECT, but it was okay to sliding and loop through all 3000 in one third of a second but its taking about 5 to 10 second to do the same in vb .net
CODE FROM MICROSOFT:
Loop I do for all labels:
here is the code I took from msdn.microsoft which is implementing control array, I have about 1500 or 3000 label in my project which only 5 to 10 of them will display at a time and they will just in and out of screen (implementing sort of timeline such as premiere) and in VB6 it was not PERFECT, but it was okay to sliding and loop through all 3000 in one third of a second but its taking about 5 to 10 second to do the same in vb .net
CODE FROM MICROSOFT:
Code:
Public Class cLabelArray
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.AddNewLabel()
End Sub
Public Function AddNewLabel() As System.Windows.Forms.Label
' Create a new instance of the Label class.
Dim aLabel As New System.Windows.Forms.Label
' Add the Label to the collection's internal list.
Me.List.Add(aLabel)
' Add the Label to the controls collection of the form
' referenced by the HostForm field.
HostForm.Controls.Add(aLabel)
' Set intial properties for the Label object.
aLabel.Top = Count * 25
aLabel.Left = 100
aLabel.Tag = Me.Count
aLabel.Text = "Label " & Me.Count.ToString
Return aLabel
AddHandler aLabel.Click, AddressOf ClickHandler
End Function
Default Public ReadOnly Property Item(ByVal Index As Integer) As System.Windows.Forms.Label
Get
Return CType(Me.List.Item(Index), System.Windows.Forms.Label)
End Get
End Property
Public Sub Remove()
' Check to be sure there is a Label to remove.
If Me.Count > 0 Then
' Remove the last Label added to the array from the host form
' controls collection. Note the use of the default property in
' accessing the array.
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 Label " & CType(CType(sender, System.Windows.Forms.Label).Tag, String))
End Sub
End Class
Loop I do for all labels:
Code:
With TimeScroll
vCursor = (.Value / .Maximum) * Subx.TimeOUT(1, Subx.Max(SelStream))
For I = 1 To Subx.Max(1)
If I > Subx.Max(1) Then Exit For
If Not (Subx.TimeIN(1, I) - vCursor) < 0 And (Subx.TimeIN(1, I) - vCursor) > Me.Width Then
StreamOne(I).Left = (Subx.TimeIN(1, I) - vCursor)
StreamOne(I).Left = (Subx.TimeIN(1, I) - vCursor)
End If
Next I
End With