Option Explicit
Public WithEvents drpb As msforms.Label
Public WithEvents ItemX As msforms.Label
Public WithEvents formX As UserForm
Public uf As Object
Public framm As Object
Public comBB As Object
Public fait As Boolean
Dim cl(0 To 100) As New ComBoTransform
Public Function transforme(comb As Object, uf)
Dim i&, Fram, It, dropbutton, pict As IPicture
If Me.fait Then Exit Function
fait = True
Set Fram = uf.Controls.Add("Forms.Frame.1", "fond")
Set dropbutton = uf.Controls.Add("Forms.Label.1", "dropbutton")
comb.ShowDropButtonWhen = 0
With dropbutton
.Height = comb.Height - 1
.Width = 13
.Font.Name = "Wingdings 3"
DoEvents
.Caption = "q"
.Font.Bold = True
.Left = comb.Left + comb.Width - .Width - 2
.Top = comb.Top
.TextAlign = 2
.BorderStyle = 1
End With
comb.Width = comb.Width - 15
With Fram
.Width = comb.Width + 15
.Left = comb.Left
.Height = comb.ListRows * 13
.Top = comb.Top + comb.Height
.ScrollBars = 2
.Visible = False
.BorderStyle = 1
For i = 0 To comb.ListCount - 1
With cl(i)
Set .drpb = dropbutton
Set .uf = uf
Set .framm = Fram
Set .comBB = comb
Set .formX = uf
End With
Set It = .Controls.Add("Forms.Label.1", "It" & i)
With It
.Caption = comb.List(i)
.Width = Fram.Width
.Height = 13
.BorderStyle = 0
.BackColor = Array(vbGreen, vbYellow)(Abs(i Mod 2 = 0))
.Top = 15 * i
.Left = 2
.Font.Name = "verdana"
End With
Set cl(i).ItemX = It
Next
.ScrollHeight = comb.ListCount * (It.Height + 2)
End With
End Function
Private Sub formX_Click(): framm.Visible = False: End Sub
Private Sub drpb_Click(): framm.Visible = True: framm.ScrollTop = 0: End Sub
Private Sub ItemX_Click(): comBB.Value = ItemX.Caption: framm.Visible = False: End Sub