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
| Option Explicit
Public WithEvents Frm As MSForms.Frame
Public WithEvents Lbel As MSForms.Label
Dim Cls() As New ClsCouleur
Dim Ctls As Control
Function ChangerCouleur(ByRef Usf As Object)
Dim i As Integer, j As Integer, Obj As Object
For j = 90 To 95
i = i + 1
ReDim Preserve Cls(1 To i)
Set Obj = Usf("Frame" & j)
Set Cls(i).Frm = Obj
Next
End Function
Function ChangerCouleur2(ByRef Usf As Object)
Dim i As Integer, j As Integer, Obj As Object
For Each Ctls In Usf.Controls
i = i + 1
ReDim Preserve Cls(1 To i)
Select Case TypeName(Ctls)
Case "Label"
Set Cls(i).Lbel = Ctls
End Select
Next Ctls
End Function
Function PasdeCouleur(ByRef Uf As Object)
For Each Ctls In Uf.Frm.Controls
If TypeOf Ctls Is MSForms.Label Then
Ctls.ForeColor = vbWhite
Ctls.SpecialEffect = fmSpecialEffectFlat
End If
Next
End Function
Function CouleurLabel(ByVal Uf As Object)
Dim i As Integer, ObjFrame As Control, j As Integer
For i = 90 To 95
j = j + 1
Set ObjFrame = Uf("Frame" & i)
For Each Ctls In Uf.ObjFrame.Controls
If TypeOf Ctls Is MSForms.Label Then
Ctls.ForeColor = &HFFFF&
Ctls.SpecialEffect = fmSpecialEffectEtched
End If
Next
Next
End Function
Private Sub Frm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
PasdeCouleur Me
End Sub
Private Sub Lbel_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
CouleurLabel Me
End Sub
Option Explicit
Dim ChgCouleur As New ClsCouleur, ChgCouleur2 As New ClsCouleur
Private Sub UserForm_Initialize()
ChgCouleur.ChangerCouleur Me
ChgCouleur2.ChangerCouleur2 Me
End Sub |
Partager