大家好日子。我在滚动面板中打印图像时遇到问题。谁能帮我这个?印刷滚动面板与图像里面在vb
我想第一调整图像,显示它在打印预览然后打印
在我的情况之前(因此它可以适应8.5×11" 纸),我有一个窗体(Form)用面板(基座=填充),我想打印里面的图像(2个图像)。但是,图像的打印的触发是在接下来的形式
在btnnext(form1中) Form2.Show() 我.Hide()
and the printing code is in the form2。我是vb中的新手,我对打印scroll没有任何意见能够面板。我在其他论坛尝试了不同的代码,但它没有打印整个图像,而是只显示了窗体的截图。 。任何反应可以理解的,太感谢你了
Public Class Form2
Private WithEvents pd As New Printing.PrintDocument
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Using bmp As New Bitmap(Form1.pb1.Width, Form1.pb1.Height)
Form1.panel1.DrawToBitmap(bmp, New Rectangle(0, 0, Form1.pb1.Width, Form1.pb1.Height))
e.Graphics.DrawImage(bmp, e.MarginBounds)
End Using
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
PrintDocument1.Print()
End Sub
End Class
- ^只打印你可以在屏幕上看到。而不是整个面板..
你使用'panel.DrawToBitmap()'? –
使用bmp作为新的位图(Form1.pb1.Width,Form1.pb1.Height) Form1.pb1.DrawToBitmap(bmp,New Rectangle(0,0,Form1.pb1.Width,Form1.pb1.Height)) e .Graphics.DrawImage(bmp,e.MarginBounds) End使用(我使用此代码,它的工作)现在唯一的问题是打印预览...我不知道在打印预览.. – user4945412
'DrawToBitmap'总是截图因此面板只能拾取可见的内容。这个问题之前在这里提出:http://stackoverflow.com/questions/22056099/with-vb-net-has-anyone-figured-out-a-way-to-print-an-entire-scrollable-form?rq = 1然而,它从来没有回答过 –