VB.NET Printing Alignment???
-
How do i make print text aligned to the centre on a page, i have tried font.style, font. everything and cant find it!: ive also tried adding this above: txtPrint.TextAlign = HorizontalAlignment.Center The code i am working with is: ev.Graphics.DrawString(txtPrint.Text, New Font("Century Gothic", 30, FontStyle.Bold), brushes.Black, 120, 120)
-
How do i make print text aligned to the centre on a page, i have tried font.style, font. everything and cant find it!: ive also tried adding this above: txtPrint.TextAlign = HorizontalAlignment.Center The code i am working with is: ev.Graphics.DrawString(txtPrint.Text, New Font("Century Gothic", 30, FontStyle.Bold), brushes.Black, 120, 120)
Use the MeasureString to get the width and height of the string and then calculate the center of the control or window to position your text. Ex. The Window's Width / 2 - TheFontWidth / 2 for the X cordinate AND The Window's Height / 2 - TheFontHeight / 2 for the Y cordinate I think you can use the TextRenderer Class to to perform some more advanced drawing even in VB.NET