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
|
Public WithEvents Lab As msforms.Label
Public WithEvents uf As UserForm
Dim Labelo(100) As New zomm_Label
Dim userf As New zomm_Label
Function initlab(usf)
Set mem = usf.Controls.Add("Forms.TextBox.1", "memo" & i)
Set userf.uf = usf
For Each ctrl In usf.Controls
If TypeName(ctrl) = "Label" Then
i = i + 1
Set Labelo(i).Lab = ctrl
ctrl.Tag = ctrl.Left & ":" & ctrl.Top & ":" & ctrl.Width & ":" & ctrl.Height & ":" & ctrl.Font.Size
End If
Next
End Function
Private Sub lab_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
memoire = Lab.Parent.Controls("memo").Value
If Lab.Name <> memoire And memoire <> "" Then
Lab.Move Lab.Left - 5, Lab.Top - 5, Lab.Width + 10, Lab.Height + 10
Lab.Font.Size = Lab.Font.Size + 3
With Lab.Parent.Controls(memoire)
.Left = Split(Lab.Parent.Controls(memoire).Tag, ":")(0)
.Top = Split(Lab.Parent.Controls(memoire).Tag, ":")(1)
.Width = Split(Lab.Parent.Controls(memoire).Tag, ":")(2)
.Height = Split(Lab.Parent.Controls(memoire).Tag, ":")(3)
.Font.Size = Split(Lab.Parent.Controls(memoire).Tag, ":")(4)
End With
End If
Lab.Parent.Controls("memo").Value = Lab.Name
End Sub
Private Sub Uf_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
memoire = uf.Controls("memo").Value
If uf.Controls("memo").Value <> "" Then
uf.Controls(memoire).Left = Split(uf.Controls(memoire).Tag, ":")(0)
uf.Controls(memoire).Top = Split(uf.Controls(memoire).Tag, ":")(1)
uf.Controls(memoire).Width = Split(uf.Controls(memoire).Tag, ":")(2)
uf.Controls(memoire).Height = Split(uf.Controls(memoire).Tag, ":")(3)
End If
End Sub |
Partager