Avé !
Je bidouille en vain pour parvenir à maitriser la rotation d'un texte avec GDI Plus, voici la fonction (qui marche pas pour la rotation => coordonnées ). Vous avez une idée ? merci
Public Sub DrawPrint2(ByRef oDest As Object, ByVal hdc As Long, ByVal Texte As String, ByVal x As Long, ByVal y As Long, _
ByVal FontColor As Long, ByVal Gras As Boolean, _
Optional ByVal lWidth As Long = 200, Optional ByVal lHeight As Long = 50, _
Optional ByVal Gauche As Boolean = True, Optional ByVal Italic As Boolean = False, Optional ByVal lSize As Long = 13, Optional ByVal lAngle As Long, _
Optional ByVal bAlignLibelleLeft As Boolean = False)
'
If Texte = vbNullString Then Exit Sub
Dim hGraphics As Long
Dim hFontFamily As Long
Dim hFont As Long
Dim hBrush As Long
Dim hStringFormat As Long
Dim lpR As GpRECTF
Dim lpR2 As GpRECTF
Dim eFontStyle As GpFontStyle
GdipCreateFromHDC hdc, hGraphics
GdipCreateSolidFill ByVal FontColor, hBrush
GdipCreateFontFamilyFromName "Calibri", 0, hFontFamily
If Gras Then
If Italic Then
eFontStyle = FontStyleBoldItalic
Else
eFontStyle = FontStyleBold
End If
Else
If Italic Then
eFontStyle = FontStyleItalic
Else
eFontStyle = FontStyleRegular
End If
End If
If lAngle <> 0 Then
GdipTranslateWorldTransform hGraphics, x * 3, y * 2, MatrixOrderPrepend
GdipRotateWorldTransform hGraphics, -lAngle, 0 'MatrixOrderAppend
End If
GdipCreateFont hFontFamily, lSize, eFontStyle, UnitPixel, hFont
GdipCreateStringFormat 0, 0, hStringFormat
lpR.left = x
lpR.top = y
lpR.Width = lWidth
lpR.Height = lHeight
'GdipMeasureString hGraphics, StrConv(Texte, vbUnicode), -1, hFont, lpR, hStringFormat, lpR, 0, 0
GdipSetTextRenderingHint hGraphics, TextRenderingHintAntiAliasGridFit
GdipDrawString hGraphics, Texte, -1, hFont, lpR, hStringFormat, hBrush
GdipDeleteStringFormat hStringFormat
GdipDeleteFont hFont
GdipDeleteFontFamily hFontFamily
GdipDeleteBrush hBrush
GdipDeleteGraphics hGraphics
End Sub