Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27512

VS 2010 How to align text within PrintDocument

$
0
0
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.

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 + FontHeight


I have tried to use 'StringAlignment.Center' but it doesn't work.

Viewing all articles
Browse latest Browse all 27512

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>