scusa ...hai ragione in realtà è che penso solo che ci sei te che rispondi e non gli altri
Questo è il codice che crea i button . da un altro routine gli arriva il numero da creare
diciamo che stiamo tra gli 800 e i 2000 button
codice:
Public Sub recupera()
'QUI TI HO MESSO SOLO LA PARTE DEL RECUPERO LINEA , ESTRAZIONE VALORI E PASSAGGIO ALLA CREAZIONE DEI PULSANTI.
FrmChart.Panel1.SuspendLayout()
Do While linea < VarCount
If FrmChart.TxtOpenChart.Items(linea) = "}" Then
Exit Do
End If
If FrmChart.TxtOpenChart.Items(linea) = "}" Or FrmChart.TxtOpenChart.Items(linea) = "{" Or FrmChart.TxtOpenChart.Items(linea) = "[ExpertSingle]" Then
FrmChart.TxtExpertSong.Text += FrmChart.TxtOpenChart.Items(linea) & vbCrLf
linea += 1
Else
AllText = FrmChart.TxtOpenChart.Items(linea)
AllTextArray = AllText.Split(" ")
InsPos = AllTextArray(0)
Uguale = AllTextArray(1)
Simbolo = AllTextArray(2)
Colore = AllTextArray(3)
Lung = AllTextArray(4)
InsNota = InsPos & " = " & Simbolo & " " & Colore & " " & Lung & vbCrLf
FrmChart.TxtExpertSong.Text += FrmChart.TxtOpenChart.Items(linea) & vbCrLf
CreaTastiV()
linea += 1
End If
Loop
FrmChart.Panel1.ResumeLayout()
End Sub
'***********************************************************
Public Sub CreaTastiV()
Posx = InsPos - FrmChart.NoteBox.HorizontalScroll.Value
Dim V As New Button
Select Case Colore
Case 0
Posy = 15
If Simbolo = "S" Then
V.BackColor = Color.Aquamarine
Else
V.BackColor = Color.GreenYellow 'colore
End If
Case 1
Posy = 65
If Simbolo = "S" Then
V.BackColor = Color.Aquamarine
Else
V.BackColor = Color.Red 'colore
End If
Case 2
Posy = 115
If Simbolo = "S" Then
V.BackColor = Color.Aquamarine
Else
V.BackColor = Color.Yellow 'colore
End If
Case 3
Posy = 165
If Simbolo = "S" Then
V.BackColor = Color.Aquamarine
Else
V.BackColor = Color.Blue 'colore
End If
Case 4
Posy = 215
If Simbolo = "S" Then
V.BackColor = Color.Aquamarine
Else
V.BackColor = Color.Orange 'colore
End If
End Select
V.Location = New Point(Posx, Posy) 'posizione pulsante
V.Size = New Size(PosLung, 40) 'grandezza pulsante
V.Name = "Pulsante" & Nome.ToString 'nome pulsante
V.Text = "" 'testo pulsante
V.FlatStyle = FlatStyle.Flat
V.Tag = InsNota 'inserisce nel tag il valore completo della nota
FrmChart.NoteBox.Controls.Add(V) 'aggiunge
AddHandler V.Click, AddressOf Pulsante_Click 'assegna click
AddHandler V.MouseHover, AddressOf Pulsante_MouseHover
AddHandler V.MouseLeave, AddressOf Pulsante_Leave
Nome += 1 'incrementa numero pulsante
Impiega 10 secondi ad estrarre i dati dal file e poi 2,30 minuti per posizionari i vari button letti dalla "list" "txtopenchart"