1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
| Public mesbouts As Object, Nb As Integer
'Dim Nb As Integer
Public Sub AjoutT_Fixe()
Dim i As Integer
Dim C As Integer, Tabi As Integer
'Dim ctrl As Control
Hauteur = FondText.top
With mesbouts
.Add ("Nb" & Nb), New ma_first_classe
mesbouts("Nb" & Nb).Name = ("Nb" & Nb)
Set mesbouts("Nb" & Nb).TxBox1 = UserForm1.Granulo.Controls.Add("Forms.Textbox.1", "T" & Nb, True)
With mesbouts("Nb" & Nb).TxBox1
.Name = "TextBox1_" & Nb
If Hauteur = 29 Then
.top = Hauteur
Else: .top = Hauteur - 7
End If
.Left = 5
.Width = 35
If Hauteur > UserForm1.Granulo.Height - 65 Then
If UserForm1.Granulo.ScrollHeight = 0 Then
UserForm1.Granulo.ScrollHeight = UserForm1.Granulo.Height + UserForm1.Granulo.ScrollHeight
Else
UserForm1.Granulo.ScrollHeight = UserForm1.Granulo.ScrollHeight + 18
End If
End If
'MsgBox mesbouts("Nb" & Nb).TxBox1.Name
On Error GoTo 2
If Not (Calibre = "" And NumTest = "") Then .Text = tamis
2
Set mesbouts("Nb" & Nb).TxBox2 = UserForm1.Granulo.Controls.Add("Forms.Textbox.1", "P" & Nb, True)
With mesbouts("Nb" & Nb).TxBox2
.Name = "TextBox2_" & Nb
.top = mesbouts("Nb" & Nb).TxBox1.top
.Left = mesbouts("Nb" & Nb).TxBox1.Left + mesbouts("Nb" & Nb).TxBox1.Width + 4 '+404
.Width = 55
' On Error GoTo 3
If Not (Calibre = "" And NumTest = "") Then .Text = Refus
3
End With
Set mesbouts("Nb" & Nb).TxBox3 = UserForm1.Granulo.Controls.Add("Forms.Textbox.1", "R" & Nb, True)
With mesbouts("Nb" & Nb).TxBox3
.Name = "TextBox3_" & Nb
.top = mesbouts("Nb" & Nb).TxBox1.top
.Left = mesbouts("Nb" & Nb).TxBox2.Left + mesbouts("Nb" & Nb).TxBox2.Width + 4 '+465
.Width = 45
'On Error GoTo 4
If Not (Calibre = "" And NumTest = "") Then .Text = Passant
4
End With
Set mesbouts("Nb" & Nb).bouton = UserForm1.Granulo.Controls.Add("Forms.CommandButton.1", "SuppTamis" & Nb)
With mesbouts("Nb" & Nb).bouton
.Name = "SuppTamis_" & Nb
.top = mesbouts("Nb" & Nb).TxBox1.top
.Left = mesbouts("Nb" & Nb).TxBox3.Left + mesbouts("Nb" & Nb).TxBox3.Width + 4 '512
.Width = 18
.Height = 18
.Caption = "-"
End With
Set mesbouts("Nb" & Nb).Kill = UserForm1.Granulo.Controls.Add("Forms.CommandButton.1", "SuppTamis_" & Nb)
With mesbouts("Nb" & Nb).Kill
'.Name = "SuppTamis_" & j + 1
.top = mesbouts("Nb" & Nb).bouton.top
.Left = mesbouts("Nb" & Nb).bouton.Left + mesbouts("Nb" & Nb).bouton.Height + 3
.Width = 18
.Height = 18
.Caption = "K"
.TabStop = False
End With
Set mesbouts("Nb" & Nb).FondText = FondText
mesbouts("Nb" & Nb).FondText.top = mesbouts("Nb" & Nb).TxBox1.top + 25
Set mesbouts("Nb" & Nb).FondR = FondR
mesbouts("Nb" & Nb).FondR.top = mesbouts("Nb" & Nb).TxBox1.top + 25
Set mesbouts("Nb" & Nb).FondP = FondP
mesbouts("Nb" & Nb).FondP.top = mesbouts("Nb" & Nb).TxBox1.top + 25
Set mesbouts("Nb" & Nb).Parent = UserForm1
K = mesbouts.keys
For C = 0 To 2
For i = 0 To mesbouts.Count - 1
mesbouts(K(i)).TableIndex Tabi, C: Tabi = Tabi + 1
Next
Next
End With
End With
Nb = Nb + 1
End Sub
Public Sub ReiniteControls()
Dim Cls, i As Integer
For Each Cls In mesbouts.items
If Cls.TxBox1.Visible Then
Cls.TxBox1.top = (Cls.TxBox1.Height * i) + 29: Cls.TxBox2.top = Cls.TxBox1.top: Cls.TxBox3.top = Cls.TxBox1.top: Cls.bouton.top = Cls.TxBox1.top: Cls.Kill.top = Cls.bouton.top: Cls.FondText.top = Cls.TxBox3.top + 25: Cls.FondR.top = Cls.FondText.top: Cls.FondP.top = Cls.FondText.top
i = i + 1
End If
Next
End Sub
Private Sub UserForm_Initialize()
Set mesbouts = CreateObject("Scripting.Dictionary")
End Sub
Private Sub UserForm_Terminate()
Set mesbouts = Nothing
End Sub |
Partager