e.Graphics.PageUnit = GraphicsUnit.Millimeter Dim f As New Font("MS ゴシック", 9, FontStyle.Regular) e.Graphics.DrawString("IN-OUT<AB>CD EFG-HIJK-LMN A<10>", f, Brushes.Black, 12.5, 30.7)
' 印刷データを指定の位置に出力します <System.Runtime.InteropServices.DllImportAttribute("gdi32.dll")> _ Friend Shared Function TextOut(ByVal hdc As IntPtr, _ ByVal nXStart As Integer, ByVal nYStart As Integer, _ ByVal lpString As String, ByVal cbString As Integer) As Integer End Function
' 論理フォントを作成します <System.Runtime.InteropServices.DllImportAttribute("gdi32.dll")> _ Friend Shared Function CreateFont(ByVal nHeight As Integer, ByVal nWidth As Integer, ByVal nEscapement As Integer, _ ByVal nOrientation As Integer, ByVal fnWeight As Integer, ByVal fdwItalic As Boolean, _ ByVal fdwUnderline As Boolean, ByVal fdwStrikeOut As Boolean, ByVal fdwCharSet As Integer, _ ByVal fdwOutputPrecision As Integer, ByVal fdwClipPrecision As Integer, ByVal fdwQuality As Integer, _ ByVal fdwPitchAndFamily As Integer, ByVal lpszFace As String) As IntPtr End Function
--------- 省略 ---------
Private Sub pd_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs)
Private Sub PrintTextOut(ByVal hdc As IntPtr, ByVal intX As Integer, ByVal intY As Integer, ByVal strPrint As String, ByVal intCount As Integer)
' SATO CL4NX-J 609dpi(24dot/mm)より1dot辺りのMillimeterを指定しています Dim dbldotmm As Double = 0.04166 Dim intPixelX As Integer = Convert.ToInt16(intX / dbldotmm) Dim intPixelY As Integer = Convert.ToInt16(intY / dbldotmm)