Bonjour le forum . bonjour a tous.
j'ai le code que j'ai pris dans ce forum. malheureusement, il agrandit tout. mais, les listbox restent identiques. que faire
Private Sub UserForm_Initialize()
Dim ctl As Control, ratioW#, ratioH#, wstate&
With Application: wstate = .WindowState: .WindowState = xlMaximized:
ratioW = Application.Width / Me.Width
ratioH = Application.Height / Me.Height
.WindowState = wstate
End With
With Me
.StartUpPosition = 0: .Left = 0: .Top = 0
.Width = (.Width * ratioW) - (.Width - .InsideWidth)
.Height = (.Height * ratioH) - (.Height - .InsideHeight) + (.Width - .InsideWidth)
End With
For Each ctl In Me.Controls
ctl.Move ctl.Left * ratioW, ctl.Top * ratioH, ctl.Width * ratioW, ctl.Height * ratioH
Select Case TypeName(ctl)
Case "TextBox", "Label", "Frame", "CommandButton", "MultiPage", "ListBox", "ComboBox", "CheckBox", "OptionButton"
ctl.Font.Size = ctl.Font.Size * Application.Min(ratioH, ratioW)
End Select
Next
End Sub
j'ai le code que j'ai pris dans ce forum. malheureusement, il agrandit tout. mais, les listbox restent identiques. que faire
Private Sub UserForm_Initialize()
Dim ctl As Control, ratioW#, ratioH#, wstate&
With Application: wstate = .WindowState: .WindowState = xlMaximized:
ratioW = Application.Width / Me.Width
ratioH = Application.Height / Me.Height
.WindowState = wstate
End With
With Me
.StartUpPosition = 0: .Left = 0: .Top = 0
.Width = (.Width * ratioW) - (.Width - .InsideWidth)
.Height = (.Height * ratioH) - (.Height - .InsideHeight) + (.Width - .InsideWidth)
End With
For Each ctl In Me.Controls
ctl.Move ctl.Left * ratioW, ctl.Top * ratioH, ctl.Width * ratioW, ctl.Height * ratioH
Select Case TypeName(ctl)
Case "TextBox", "Label", "Frame", "CommandButton", "MultiPage", "ListBox", "ComboBox", "CheckBox", "OptionButton"
ctl.Font.Size = ctl.Font.Size * Application.Min(ratioH, ratioW)
End Select
Next
End Sub