Hello everyone,
please have a look on attached picture and code.
You can see amount in words, I want to increase line spacing on word wrap for 2nd line. I am using VS 2013 and printdocument is used to print this cheque.
Thank you
Ladak!
please have a look on attached picture and code.
You can see amount in words, I want to increase line spacing on word wrap for 2nd line. I am using VS 2013 and printdocument is used to print this cheque.
Code:
Private Sub PrintDocument1_PrintPage(sender As Object, e As Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim g As Graphics = e.Graphics
g.PageUnit = GraphicsUnit.Millimeter
'' Number Format
Dim Numformat As StringFormat = New StringFormat
Numformat.Alignment = StringAlignment.Near
Numformat.LineAlignment = StringAlignment.Near
Numformat.FormatFlags = StringFormatFlags.NoWrap
' Text Format
Dim TextFormat As New System.Drawing.StringFormat
TextFormat.LineAlignment = StringAlignment.Near ' .Center ' .Near ' center horizontally
TextFormat.Alignment = StringAlignment.Near ' center vertically
TextFormat.Trimming = StringTrimming.Word
'TextFormat.FormatFlags = StringFormatFlags.NoWrap
Dim SdsFont As Font = New Font("Tahoma", 8, FontStyle.Regular)
' Counter Side
Dim rectF1 As New RectangleF
If ChkPrintCounter.Checked = True Then
e.Graphics.PageUnit = GraphicsUnit.Millimeter
rectF1 = New RectangleF(Val(txtCounterDateX.Text), Val(txtCounterDateY.Text), 25, 10)
e.Graphics.DrawString(lblChequeDate.Text, SdsFont, Brushes.Black, rectF1, TextFormat)
e.Graphics.PageUnit = GraphicsUnit.Millimeter
rectF1 = New RectangleF(Val(txtCounterPayX.Text), Val(txtCounterPayY.Text), 25, 20)
e.Graphics.DrawString(txtPayTo.Text, SdsFont, Brushes.Black, rectF1, TextFormat)
e.Graphics.PageUnit = GraphicsUnit.Millimeter
rectF1 = New RectangleF(Val(txtCounterAmountX.Text), Val(txtCounterAmountY.Text), 25, 10)
e.Graphics.DrawString(lblChequeAmount.Text, SdsFont, Brushes.Black, rectF1, Numformat)
End If
'
' End of Counter
' Main Side
e.Graphics.PageUnit = GraphicsUnit.Millimeter
rectF1 = New RectangleF(Val(txtMainDateX.Text), Val(txtMainDateY.Text), 40, 10)
e.Graphics.DrawString(lblChequeDate.Text, SdsFont, Brushes.Black, rectF1, TextFormat)
e.Graphics.PageUnit = GraphicsUnit.Millimeter
rectF1 = New RectangleF(Val(txtMainPayX.Text), Val(txtMainPayY.Text), 125, 10)
e.Graphics.DrawString(txtPayTo.Text, SdsFont, Brushes.Black, rectF1, TextFormat)
e.Graphics.PageUnit = GraphicsUnit.Millimeter
rectF1 = New RectangleF(Val(txtMainRupeesX.Text), Val(txtMainRupeesY.Text), 30, 10)
e.Graphics.DrawString("=" & lblChequeAmount.Text, SdsFont, Brushes.Black, rectF1, Numformat)
e.Graphics.PageUnit = GraphicsUnit.Millimeter
rectF1 = New RectangleF(Val(txtMainRupeesInWordsX.Text), Val(txtMainRupeesInWordsY.Text), 90, 20)
e.Graphics.DrawString(lblChequeAmountInWords.Text, SdsFont, Brushes.Black, rectF1, TextFormat)
' End of Main Side
Dim X1 As Integer = Val(txtCrossX.Text)
Dim Y1 As Integer = Val(txtCrossY.Text)
If ChkCrossCheque.Checked = True Then
e.Graphics.PageUnit = GraphicsUnit.Millimeter
e.Graphics.DrawImage(PictureBox1.Image, X1, Y1, 25, 8)
End If
End Sub
Thank you
Ladak!