C#如何直接调用打印机
比如那个入仓单和出仓单,都要打印,怎么掉用啊...打印机是HP的...别拿那个网上搜到的放上来,对这个深恶痛绝...知道的就说说,要是可以直接写一个简单调用的实例给我就最...
比如那个入仓单和出仓单,都要打印,怎么掉用啊...打印机是HP的...
别拿那个网上搜到的放上来,对这个深恶痛绝...
知道的就说说,要是可以直接写一个简单调用的实例给我就最好了
我的邮箱 clpengmei@163.com
这里先谢谢了... 展开
别拿那个网上搜到的放上来,对这个深恶痛绝...
知道的就说说,要是可以直接写一个简单调用的实例给我就最好了
我的邮箱 clpengmei@163.com
这里先谢谢了... 展开
6个回答
展开全部
1.本地打印机
//添加引用并using System.Management;
public static void AvailablePrinters()
{
ManagementScope ms = new ManagementScope(ManagementPath.DefaultPath);
ms.Connect();
SelectQuery sq = new SelectQuery();
sq.QueryString = @"SELECT Name FROM Win32_Printer";
ManagementObjectSearcher mos =
new ManagementObjectSearcher(ms, sq);
ManagementObjectCollection oObjectCollection = mos.Get();
foreach (ManagementObject mo in oObjectCollection)
MessageBox.Show(mo["Name"].ToString());
}
2.网络打印机
via System.Drawing.Printing
foreach (String printer in PrinterSettings.InstalledPrinters)
{
Console.WriteLine(printer.ToString()+Environment.NewLine);
}
via WMI
public static void AvailablePrinters()
{
oManagementScope = new ManagementScope(ManagementPath.DefaultPath);
oManagementScope.Connect();
SelectQuery oSelectQuery = new SelectQuery();
oSelectQuery.QueryString = @"SELECT Name FROM Win32_Printer";
ManagementObjectSearcher oObjectSearcher =
new ManagementObjectSearcher(oManagementScope, @oSelectQuery);
ManagementObjectCollection oObjectCollection = oObjectSearcher.Get();
foreach (ManagementObject oItem in oObjectCollection)
{
Console.WriteLine("Name : " + oItem["Name"].ToString()+ Environment.NewLine);
}
}
via PowerShell
Get-WMIObject -class Win32_Printer -computer $printserver | Select Name,DriverName,PortName
//添加引用并using System.Management;
public static void AvailablePrinters()
{
ManagementScope ms = new ManagementScope(ManagementPath.DefaultPath);
ms.Connect();
SelectQuery sq = new SelectQuery();
sq.QueryString = @"SELECT Name FROM Win32_Printer";
ManagementObjectSearcher mos =
new ManagementObjectSearcher(ms, sq);
ManagementObjectCollection oObjectCollection = mos.Get();
foreach (ManagementObject mo in oObjectCollection)
MessageBox.Show(mo["Name"].ToString());
}
2.网络打印机
via System.Drawing.Printing
foreach (String printer in PrinterSettings.InstalledPrinters)
{
Console.WriteLine(printer.ToString()+Environment.NewLine);
}
via WMI
public static void AvailablePrinters()
{
oManagementScope = new ManagementScope(ManagementPath.DefaultPath);
oManagementScope.Connect();
SelectQuery oSelectQuery = new SelectQuery();
oSelectQuery.QueryString = @"SELECT Name FROM Win32_Printer";
ManagementObjectSearcher oObjectSearcher =
new ManagementObjectSearcher(oManagementScope, @oSelectQuery);
ManagementObjectCollection oObjectCollection = oObjectSearcher.Get();
foreach (ManagementObject oItem in oObjectCollection)
{
Console.WriteLine("Name : " + oItem["Name"].ToString()+ Environment.NewLine);
}
}
via PowerShell
Get-WMIObject -class Win32_Printer -computer $printserver | Select Name,DriverName,PortName
2013-11-11
展开全部
有一个打印机的控件。很简单。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你的打印机,直接拿过来接上就行。
不是你的打印机,向你领导申请下!
不是你的打印机,向你领导申请下!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
我写了一个实例,关于打印的,打印图片的, 如果你需要 就联系我吧 qq:279337426 <a href="http://wenwen.sogou.com/login/redirect?url=http%3a%2f%2fwww.tongxuetang.com" target="_blank">http://www.tongxuetang.com</a>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-11-11
展开全部
是在串口输出么?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询