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)
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)
Sub SetFont でフォントを生成する際に、 MM_TEXT から MM_LOMETRIC あるいは MM_HIMETRIC で 生成するようにしてみては如何でしょうか。
> Private Sub pd_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) > Dim mFont As IntPtr ここで宣言されたローカル変数の mFont と
> Private Sub SetFont(ByVal control As IntPtr, ByVal fontFamily As String, ByVal fontSize As Integer) > mFont = CreateFont(fontSize * -1, 0, 0, 0, 400, 0, 0, 0, 1, 0, 0, 0, 0, fontFamily) ここで利用されているフィールド変数の mFont は それぞれ別の変数ですが、大丈夫ですか?
<System.Runtime.InteropServices.DllImportAttribute("gdi32.dll")> Friend Shared Function SetMapMode(ByVal hdc As Integer, ByVal fnMapMode As Integer) As Integer End Function
を追加しまして、
Private Sub SetFont(ByVal control As IntPtr, ByVal fontFamily As String, ByVal fontSize As Integer)