打印预览中的打印机按钮问题 - vb 2010 [英] problem with printer button in print preview - vb 2010

查看:87
本文介绍了打印预览中的打印机按钮问题 - vb 2010的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PrintPreviewDialog1上的打印机按钮不起作用。我以预览模式启动了报表,我希望能够单击打印预览控件左上角的小打印机按钮(打印机图标),并打印正在预览的报表。它不是。我得到的是非常奇怪的。如果报告有三页,那么打印是第4页只有标题。当然我不想要这个页面,我想要报告的三页。



我已经做了很多谷歌搜索和搜索,因为我相信其他人一定已经解决了这个问题,但我找不到任何答案。



如果我必须把代码放在''后面''按钮我知道放在那里的代码(m_PrintDocument.Print())。我只是不知道如何把这个代码放在这个按钮后面。



任何指导都会非常感激。

The printer button on the PrintPreviewDialog1 doesn''t work. I have my report up in preview mode and I want to be able to click the little printer button (printer icon) in the top left of the print preview control and have the report that is being previewed, print. It doesn''t. What I get is very strange. If the report has three pages what prints is a 4th page with just headings. Of course I don''t want this page, I want the three pages of the report.

I''ve done a lot of googling and searching as I believe others must have had, and solved, this problem but I can''t find any answers.

If I have to put code ''behind'' the button I know the code to put there (m_PrintDocument.Print()). I just don''t know how to put this code ''behind'' this button.

Any guidance would be greatly appreciated.

推荐答案

您是否已经尝试过printdialog,您可以选择打印机。



Did you already try it a printdialog where you can select the printer.

'Allow the user to choose a printer and specify other settings.
Dim dlgPrint As New PrintDialog

With dlgPrint
    .Document = Me.Document
    .AllowSelection = False
    .ShowNetwork = False
    .AllowCurrentPage = True
    .AllowSomePages = True
End With

'If the user clicked OK, print the document.
If dlgPrint.ShowDialog = Windows.Forms.DialogResult.OK Then
    Me.Document.Print()
End If


我希望有一些方法可以放置代码打印机按钮,但我想没有。另一个更好的解决方案是让microsoft使该按钮工作并打印预览的内容。它不会这样做已经非常令人费解了。所以,我不确定是否有任何解决方案。所以,我的意图是关闭这个问题。谢谢。
I was hoping that there would be some way to place code behind that printer button but I guess there is not. Another, better solution, would be for microsoft to make that button work and print what it being previewed. That it doesn''t do this already is pretty mindblowing. So, I''m not sure there is any solution. So, my intent is to close this question. Thank you.


如果您要将打印输出作为报告,您必须准备好开始报告。



例如,正在打印的文本文件必须在预览结束时重置为文件的开头。



我的语言是avr所以我希望这样做感觉。



sr,流阅读器,在预览结束时关闭。

e.HasMorePages = * false

sr.Close()



预览打印按钮再次调用Printpage事件。文本文件

重新打开。

If you are driving the print output as a report, you must be prepared to start the report over.

For example, A text file being printed must be reset to the beginning of the file at the end of the preview.

My language is avr so I hope this makes sense.

The sr, stream reader, is closed at the end of the preview.
e.HasMorePages = *false
sr.Close()

The preview print button calls the Printpage event again. The text file
is reopened to the beginning.
BegSr printDocument1_PrintPage Access(*Private) Event(*this.printDocument1.PrintPage)
		DclSrParm sender *Object
		DclSrParm e System.Drawing.Printing.PrintPageEventArgs
	
		dclfld pinx  *integer2
		if currentindex = 0
			sr = *New System.IO.StreamReader(BarCd_FileName) 
		endif
		pinx = 0
		do fromval(0) toval(50-1) index(pinx)
			if sr.Peek() < 0
				leave
			endif	
			OsFileLine = sr.ReadLine()
			if OsFileLine = *nothing
				iterate
			endif	
			TextPaint(pinx, e.Graphics )
		enddo
		
 		if sr.Peek() >= 0
 			Current_Page = Current_Page + 1
			e.HasMorePages = *true
		else	
			e.HasMorePages = *false	
			sr.Close()
			currentindex = 0
		endif
				
	EndSr


这篇关于打印预览中的打印机按钮问题 - vb 2010的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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