Function getControlRectangleForM(obj As Object) As RECT
Dim LfT As Double, Rgt As Double, Top As Double, P As Object, PInsWidth As Double, PInsHeight As Double, z#
Dim K As Double, r As RECT, uu, ItemSize#
LfT = obj.Left: Top = obj.Top: Set P = obj.Parent
Do
PInsWidth = P.InsideWidth: PInsHeight = P.InsideHeight: If TypeOf P Is MSForms.Page Then Set P = P.Parent
K = (P.Width - PInsWidth) / 2: LfT = (LfT + P.Left + K): Top = (Top + P.Top + P.Height - K - PInsHeight)
If Not (TypeOf P Is MSForms.Frame Or TypeOf P Is MSForms.MultiPage) Then Exit Do
Set P = P.Parent
Loop
With ActiveWindow.Panes(1)
z = .Parent.Zoom / 100.01
r.Left = .PointsToScreenPixelsX(LfT / z) - .PointsToScreenPixelsX(0)
r.Top = .PointsToScreenPixelsY(Top / z) - .PointsToScreenPixelsY(0)
r.Right = Round(r.Left + (.PointsToScreenPixelsX(obj.Width / z) - .PointsToScreenPixelsX(0)), 2)
r.Bottom = Round(r.Top + (.PointsToScreenPixelsY(obj.Height / z) - .PointsToScreenPixelsY(0)), 2)
'If TypeName(obj) = "ComboBox" Then
'calcul du rectangle présumé du child de la combo
' Set uu = USFForm.Controls.Add("forms.label.1", "uu")
' With uu
' .Height = 1: .Width = 1: .Font.Size = obj.Font.Size: .Font.Name = obj.Font.Name: .Font.Bold = obj.Font.Bold
' .Caption = "A": .BorderStyle = 1: .BackColor = vbYellow
' .AutoSize = True
' ItemSize = .Height - 1
'End With
' USFForm.Remove "uu"
' r.Bottom = r.Bottom + (((ItemSize) * obj.ListRows) * Ppx)
'r.Bottom = r.Bottom + ((ItemSize * (obj.ListRows - IIf(obj.Font.Size < 9, 1, 0)) - 2) * Ppx)
'r.Top = r.Top + (obj.Height * Ppx)
'End If
End With
getControlRectangleForM = r
End Function