Hello.
I have been trying to print a document from my application, I have been able to fix a couple of problems my self but now Im stuck.
I would like to habe the possibility to align text(left,center,right), it must be possible the set alignment of each column separatly.
How could I integrade in my code bellow
The code is based on an example called vbreport found at Microsofts homepage.
Here I write some data from a from my datareadr, then I set the alignment, the 0 indicates the fontstyle(0 for nomal,1 for bold etc.)
e.Write(reader("KontoNr"), ReportLineJustification.Left, 0)
Here is the sub which sets the location of the text
Public Sub Write(ByVal Text As String, _
ByVal Justification As ReportLineJustification, ByVal Style As Integer)
Select Case Justification
Case ReportLineJustification.Left
mX = 5
End Select
End Sub
Here I actualy draw the text to the "paper", here I would like to have possiblity to change the alignment.
Public Sub Write(ByVal Text As String, ByVal Font As String, ByVal Size As Integer, ByVal Style As Integer)
' Fontstyle is set by its number as an integer
'Example
'FontStyle.Regular = 0
Dim the_font As New Font(Font, _
Size, Style, GraphicsUnit.Point)
Graphics.DrawString(Text, the_font, mBrush, mX, mY)
mX += CInt(Graphics.MeasureString(Text, the_font).Width)
End Sub

Print document with Alignment
Dan Crevier
Perhaps you could try using a StringFormat object and including that in the DrawString parameters.
StringFormat strFmt = new StringFormat();
strFmt.Alignment = StringAlignment.Center;
Is that what you're after
Toop
adolydenko