1
我编写了代码以获取安装在我系统中的打印机的名称,但我不知道要获取该打印机的端口名称。这里是我写的代码。如何在wpf中获取默认选定打印机的端口名称
public MainWindow()
{
this.InitializeComponent();
PrintServer server = new PrintServer();
foreach (PrintQueue queue in server.GetPrintQueues())
{
cboPrinters.Items.Add(queue.FullName);
}
var DefaultPrinter = new LocalPrintServer().DefaultPrintQueue;
string default_name=DefaultPrinter.FullName;
txxt_default.Text = "The default printe is "+" "+default_name;
}
它的结果会是这样
我得选择打印机端口名称 “DOP7”(如下图所述)。请帮助我。
非常感谢。我得到了我需要的东西。但是我需要得到选择项目的(从组合框项目)queuepot name.i的意思是如果我从组合框中选择传真,我必须得到选择项目queueport name.pleae帮助我。 –
然后另一件事是,我必须得到选定的项目的波特率,数据位,奇偶校验,停止位,端口和流量CONTROL.pleae LPL帮助我完全希望你... –
请参阅我的编辑。为了从QueuePort获得[SerialPort类属性](http://msdn.microsoft.com/en-us/library/system.io.ports.serialport_properties),请提出一个单独的问题。 – LPL