Printing Doesn't Print at the specified location

Dec 5 2013 2:47 AM
I use the following code to print text "A" at 100,200 (Points), But it prints at 114,180, What is wrong with my code?


Imports System.IO
Imports System.Drawing.Printing


Public Class Form1
    Public egraphics As Graphics
    Public prnDocument As New System.Drawing.Printing.PrintDocument

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim psize As New Printing.PaperSize("A4", 842, 595)

        AddHandler prnDocument.PrintPage, AddressOf PrintPage

        prnDocument.DefaultPageSettings.PaperSize = psize
        prnDocument.DefaultPageSettings.Margins.Top = 0
        prnDocument.DefaultPageSettings.Margins.Left = 0
        prnDocument.DefaultPageSettings.Margins.Bottom = 0
        prnDocument.DefaultPageSettings.Margins.Right = 0
        prnDocument.OriginAtMargins = True


        prnDocument.Print()
    End Sub

    Private Sub PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs)
        Dim fReportFont As System.Drawing.Font

        egraphics = e.Graphics
        egraphics.PageUnit = GraphicsUnit.Point
        fReportFont = New System.Drawing.Font(Trim("Helvetica"), 60, FontStyle.Regular)
        egraphics.DrawString("A", fReportFont, New SolidBrush(Color.Black), 100, 200)

    End Sub

End Class


Answers (1)