Question : Richtextbox .. Center First Line with larger font ... remianing Body left justified with smaller font

I have a short description being displayed in a richtextbox .. LIKE

2005 Ford Mustang
 This is the 2005 BlahBlahBlah
BlahBlahBlahBlahBlahBlahBlah
BlahBlahBlahBlahBlahBlah.

I need the first Line to be Centered and font size around 12 to 14  and bold
then remaining body to be left justified with smaller font and normal not bold.

Answer : Richtextbox .. Center First Line with larger font ... remianing Body left justified with smaller font

Try this out...
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim myTitle As String = "2005 Ford Mustang" & vbCrLf
        Dim myBody As String = _
            "BlahBlahBlahBlahBlahBlah" & vbCrLf & _
            "ClahClahClahClahClahClah" & vbCrLf & _
            "DlahDlahDlahDlahDlahDlah" & vbCrLf

        RichTextBox1.Clear()

        RichTextBox1.SelectionAlignment = HorizontalAlignment.Center
        RichTextBox1.SelectionFont = New Font(RichTextBox1.Font.FontFamily, 14, FontStyle.Bold)
        RichTextBox1.SelectedText = myTitle

        RichTextBox1.SelectionAlignment = HorizontalAlignment.Left
        RichTextBox1.SelectionFont = New Font(RichTextBox1.Font.FontFamily, 12, FontStyle.Regular)
        RichTextBox1.SelectedText = myBody
    End Sub

End Class
 
 
Random Solutions  
 
programming4us programming4us