textbox with right align in VB print

Asked

Viewed 44 times

1

I have a printdocument with the following command

Dim font1 As New Font("Arial", 15, FontStyle.Regular)
e.Graphics.DrawString(txtnome.Text, font1, Brushes.Black, 10, 10)

And when I print the textbox is left to right, even with the textbox property with textalign: right.

How do I make the print look the same in the textbox with the text coming from right to left?

1 answer

0

I think the parameter StringFormat is able to solve your problem:

Dim sf As StringFormat = New StringFormat()
Dim font1 As New Font("Arial", 15, FontStyle.Regular)

sf.LineAlignment = StringAlignment.Far
sf.Alignment = StringAlignment.Far

e.Graphics.DrawString(txtnome.Text, font1, Brushes.Black, 10, 10, sf)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.