Oppure

Loading
17/05/08 7:55
passamaglia
Ho la necessita' di stampare un testo perfettamente centrato (uso VB2005 express).
C'e' qualcuno che ha idee in merito?
Grazie.
aaa
17/05/08 12:24
manvb.net
stampare dove? in un controllo?
aaa
17/05/08 15:05
Il Totem
Credo che tu intenda da stampante. Beh usa i normali eventi di stampa e per quanto riguarda la posizione del testo, puoi calcolarla in questo modo per ogni riga ad esempio così:
'Nell'evento PrintDocument.Printpage
Dim Center As New Point(e.PageBounds.Width / 2, _
  e.PageBounds.Height / 2)
Dim Str As String = "Testo da stampare."
Dim Font As New Font("Timer New Roman", 14, FontStyle.Regular)
Dim Size As SizeF = e.Graphics.MeasureString(Str, Font)
Dim Start As New Point(Center.X - Size.Width / 2, Center.Y - Size.Height / 2)

e.Graphics.RenderingOrigin = New Point(0, 0)
e.Graphics.DrawString(Str, Font, Brushes.Blue, Start)
aaa