Possible Duplicate:
How to color individual characters and maintain proper spacing / kerning / alignment?
Using GDI+, I would like to break a string up into individual characters so I can change the font type, size, or weight at any point within the string.
Usage Examples:
****B****olding the first character.
Using the Old English font for the first character (i.e. "Once upon a time" -> "O" = Old English font)
Underlining a specific word (group of characters) within a sentence.
I cannot find any examples. I'm not sure how to approach this.
Public Class Character
Public Property ID As Integer
Public Property Value As Char
Public Property CharacterFont As Font
Public Property CharacterColor As Brush
Public Sub New()
CharacterFont = New Font("Times New Roman", 12)
End Sub
End Class
......
Public Class CharacterBlock
Private _characters As New List(Of Character)
Public Property Alignment As StringAlignment
Public Sub New()
Alignment = StringAlignment.Center
End Sub
Public Sub New(p_characters As List(Of Character))
Me.New()
_characters = p_characters
End Sub
Public Sub New(p_characters As String)
Me.New()
_characters = (From s In p_characters.ToList Select New Character With {.Value = s}).ToList
End Sub
Public Sub New(p_characters As String, p_font As System.Drawing.Font)
Me.New()
_characters = (From s In p_characters.ToList Select New Character With {.Value = s, .CharacterFont = p_font}).ToList
End Sub
'TODO: Add methods to measure and draw character blocks
End Class