如何设置或指定要打印的页数

如何设置或指定要打印的页数

本文介绍了如何设置或指定要打印的页数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个richtextbox来输入我要打印的文本,打印命令是按钮而不是printdialog框((PrintDialog1.ShowDialog()== System.Windows.Forms.DialogResult.OK))为了显示,我创建了组合框,它将显示可用的打印机然后打印。喜欢这个代码。



获得可用的打印机:



foreach(PrinterSettings中的字符串打印机。已安装的打印机)

{

cbox.Items.Add(printer.ToString());

}



和打印按钮:



PrintDocument1.PrinterSettings.PrinterName = cbox.SelectedItem.ToString();



PrintDocument1.Print();



现在我要做的是我会添加一些文本框来输入页面要打印的号码。例如,当我要运行程序时,richtextbox中的当前页面是12页,我将在文本框中输入我想要的页面(3-7页)。怎么会这样 ?

I created a richtextbox to input the text that I want to print, the command for printing which is the button and instead of printdialog box((PrintDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)) to be display, I created combobox which will display the available printers and then print. Like this code bellow .

To get the available printers:

foreach (String printer in PrinterSettings.InstalledPrinters)
{
cbox.Items.Add(printer.ToString());
}

And the button for printing :

PrintDocument1.PrinterSettings.PrinterName = cbox.SelectedItem.ToString();

PrintDocument1.Print();

Now what I want to do is I will add some textbox to input the page number to be printed . For example the current pages in the richtextbox are 12pages when I'm going to run the program I will input in the textbox the page/s that I want like (3-7pages). How could it be ?

推荐答案



这篇关于如何设置或指定要打印的页数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 11:01