Réponse acceptée !
Slt,
merci pour ton aide.
J'ai essayé de l'utiliser mais ça ne marche pas, rien n'apparait dans ma picturebox. Peux-tu me dire ou je me suis planté?
(Je suis allé voir dans
www.vbfrance.com/codes/API-DRAWTEXT-EXPLICATIONS-EXEMPLE_2781.aspx)
'Dans un module
Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Public Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
Public Const DT_BOTTOM = &H8
Public Const DT_CALCRECT = &H400
Public Const DT_CENTER = &H1
Public Const DT_EXPANDTABS = &H40
Public Const DT_EXTERNALLEADING = &H200
Public Const DT_LEFT = &H0
Public Const DT_NOCLIP = &H100
Public Const DT_NOPREFIX = &H800
Public Const DT_RIGHT = &H2
Public Const DT_SINGLELINE = &H20
Public Const DT_TABSTOP = &H80
Public Const DT_TOP = &H0
Public Const DT_VCENTER = &H4
Public Const DT_WORDBREAK = &H10
'Dans ma form
Dim R As RECT
Dim Ret As Long
picture2.autoRedraw = true
R.Bottom = Label1(i).Top + Label1(i).Height
R.Left = Label1(i).Left
R.Top = Label1(i).Top
R.Right = Label1(i).Left + Label1(i).Width
Ret = DrawText(Me.Picture2.hdc, Label1(i).Caption, Len(Label1(i).Caption), R, DT_TOP + DT_CENTER)