如何在Wpf Vb中获取打印对话框 [英] How Do I Get A Print Dialog In Wpf Vb

查看:95
本文介绍了如何在Wpf Vb中获取打印对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网站上看了

I looked on the site

http://msdn.microsoft.com/en-us/library/aa970848(v=vs.110).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1
http://msdn.microsoft.com/en-us/library/aa969772(v=vs.110).aspx
http://msdn.microsoft.com/en-us/library/system.windows.xps.xpsdocumentwriter(v=vs.110).aspx
http://www.codeproject.com/Articles/33076/WPF-Printing-Basic-Text-Printing
http://www.dotnetheaven.com/article/printing-in-wpf-using-vb.net

我想打印一个文本框,可以选择它去哪个打印机,也许它也可以打印图像。



微软MSDN不是很好,它没有说要包括什么,它强迫因为IDK Visual Studio无法识别XPS文档而无法使用XPS。



以下代码不起作用:

I want to print a text box, with a choice of which printer it goes to, and maybe it could also print images too.

Microsoft MSDN is not great it doesn't say what to include, and it forces the use of XPS which doesn't work because IDK Visual studio doesn't recognise XPS Documents.

Heres some code that doesn't work:

Dim xpsDocument As New XpsDocument("C:\FixedDocumentSequence.xps", FileAccess.ReadWrite)

我甚至无法访问学校的C:\以便它运行它不会工作,但它不会运行,因为XpsDocument的问题,这是什么,我试图包括

Imports System.Windows.XPS 但这不起作用,这是有史以来最糟糕的语言。为什么没有人设法在VB上用WPF中的对话框打印?

I don't even have access to the C:\ at school so that if it ran it wouldn' work but it won't run because of the issues with XpsDocument, what is that and I tried to include
Imports System.Windows.XPS but that didn't work, this is the worst Language ever. Why has no one managed to print with a dialogue box in WPF on VB before?

推荐答案

你好,



您可以使用此代码获取所有打印机的列表c#





for(int i = 0; i< PrinterSettings。 InstalledPrinters.Count; i ++)

{

pkInstalledPrinters = PrinterSettings.InstalledPrinters [i];



} <使用上面的代码你将得到pkInstalledPrinters变量中的打印机列表,现在用下拉列表绑定它。现在在按钮点击时写下打印代码。

如果对此有任何帮助,请告诉我。
Hello,

You can get list of all printers using this code in c#


for (int i = 0; i < PrinterSettings.InstalledPrinters.Count; i++)
{
pkInstalledPrinters = PrinterSettings.InstalledPrinters[i];

}

using above code you will get list of printers in "pkInstalledPrinters" variable, now bind this with dropdown. Now write printing code on button click.
If any more help regarding this let me know.


这篇关于如何在Wpf Vb中获取打印对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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