在更多页面VB.NET中打印标签 [英] Print label in more pages VB.NET

查看:164
本文介绍了在更多页面VB.NET中打印标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I use a code to print a libel with all its contents and move to the next page but the problem

1 - Printing breaks the base of the first page when moving to the next page I want to have a vacuum at the end of the page 1

Print completes the next page but prints at the bottom of the page rather than the top of the page

The image appears inside the lable and is contained and does not appear below the lable when printing

What I have tried:

<pre> Static Lines() As String = Label1.Text.Split(vbCrLf)
        Static Font As New Font("Arial", 10, FontStyle.Regular, GraphicsUnit.Pixel)
        Static I As Integer
        Dim bmp As System.Drawing.Bitmap
        bmp = PictureBox1.Image
        Dim VerticalPos As Integer = 1000
        Do
            e.Graphics.DrawString(Lines(I), Font, Brushes.Black, 200, VerticalPos)
            I += 1
            VerticalPos += Font.Height
            e.Graphics.DrawImage(bmp, 200, VerticalPos + 100)
            If VerticalPos > e.PageBounds.Bottom Then
                e.Graphics.DrawImage(bmp, 200, VerticalPos)
                e.HasMorePages = True
                Return
            End If
        Loop Until I = Lines.Length
    End Sub

推荐答案

您对 VerticalPos 的比较与页面的末尾不正确。您需要在绘制位图之前检查它以确保有足够的空间。绘制图像后也不会更新它,因此从那时起你的定位将不正确。
Your comparison of VerticalPos with the end of the page is not correct. You need to check it before you draw the bitmap to ensure there is enough space. You also do not update it after you draw the image, so your positioning will be incorrect from that point on.


这篇关于在更多页面VB.NET中打印标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆