I have created some code to print a line and I was wondering if anybody know's how to align the text to the center of the page.
I have tried to use 'StringAlignment.Center' but it doesn't work.
Code:
Dim x, y, size, FontHeight As Integer
Dim MyHeadlineFont As New Font("Arial", 25, FontStyle.Bold)
Dim DLine1 As String
FontHeight = MyFont.GetHeight(e.Graphics)
x = 50
y = 50
e.Graphics.DrawString("This is a line of text", MyHeadlineFont, Brushes.Black, x, y)
y = y + FontHeightI have tried to use 'StringAlignment.Center' but it doesn't work.