VB.NET
Public Function CreateRotatedFont(ByVal FontName As String, ByVal Height As Integer, ByVal AngleInDegrees As Integer, ByVal g As Graphics) As Font
Dim logf As New LogFont()
logf.Height = -1 * Height
logf.FaceName = FontName
logf.Escapement = AngleInDegrees * 10
logf.Orientation = logf.Escapement
logf.CharSet = LogFontCharSet.Default
logf.OutPrecision = LogFontPrecision.Default
logf.ClipPrecision = LogFontClipPrecision.Default
logf.Quality = LogFontQuality.ClearType
logf.PitchAndFamily = LogFontPitchAndFamily.Default
Return Font.FromLogFont(logf)
End Function
:
Dim myGraphic As Graphics = Me.CreateGraphics()
Dim myFont As Font = CreateRotatedFont("Tahoma", 32, 90, myGraphic)
Dim myBrush As New SolidBrush(Color.Black)
myGraphic.DrawString("Hello", myFont, myBrush, 200, 103)
source
share