C# 获取打印机列表以及串口
C# 获取打印机列表以及默认打印机、串口列表。
/// <summary>
/// 获取本地已安装的打印机
/// </summary>
/// <returns></returns>
public string GetPrinter()
{
string strList = "";
System.Drawing.Printing.PrinterSettings.StringCollection PrinterList = System.Drawing.Printing.PrinterSettings.InstalledPrinters;
foreach (var item in PrinterList)
{
strList += item + ",";
}
return strList;
} /// <summary>
/// 获取默认打印机
/// </summary>
/// <returns></returns>
public string GetDefault()
{
System.Drawing.Printing.PrintDocument p = new System.Drawing.Printing.PrintDocument();
return p.DefaultPageSettings.PrinterSettings.PrinterName;
} /// <summary>
/// 获取可用的端口
/// </summary>
/// <returns></returns>
public static List<string> GetComList()
{
List<string> ComList = new List<string>();
Microsoft.VisualBasic.Devices.Computer pc = new Microsoft.VisualBasic.Devices.Computer();
foreach (string s in pc.Ports.SerialPortNames)
{
ComList.Add(s);
}
return ComList;
}
C# 获取打印机列表以及串口的更多相关文章
- C-Lodop获取打印机列表Create_Printer_List
C-Lodop获取打印机列表Create_Printer_List,此方法Lodop不支持,是C-Lodop特有的函数,客户端本地打印单独用c-lodop,或集中打印等,可以获得本机或云主机的打印机列 ...
- Lodop在页面获取打印机列表 选择打印机预览
利用GET_PRINTER_COUNT,获取打印机个数,然后用GET_PRINTER_NAME(intPrinterIndex);循环获取打印机名称,添加到list列表里,可以让用户在页面就选择打印机 ...
- [C#] 获取打印机列表
一:获得本地安装的打印机列表 注:(如果在"设备和打印机"中已经添加了局域网的打印机设备,也算是本地安装的打印机:没有添加的则算作局域网打印机) 1,通过 C# 中 Printer ...
- C#获取本地打印机列表,并将指定打印机设置为默认打印机
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.W ...
- 获取WINDOWS打印机列表
获取WINDOWS打印机列表 如何知道WINDOWS已经安装了哪些打印机? 1) usesVcl.Printers 2) Printer.Printers // property Printers: ...
- .Net中获取打印机的相关信息
原文:.Net中获取打印机的相关信息 新项目中牵涉到对打印机的一些操作,最重要的莫过于获取打印机的状态,IP等信息,代码量不大,但是也是自己花了一点时间总结出来的,希望能帮助需要的朋友. Printe ...
- SQL Server获取月度列表
-- 获取月度列表 if exists(select 1 from sysobjects where name = 'proc_GetDateMonthList' and type = 'p') dr ...
- python 获取一个列表有多少连续列表
python 获取一个列表有多少连续列表 例如 有列表 [1,2,3] 那么连续列表就是 [1,2],[2,3],[1,2,3] 程序实现如下: 运行结果:
- XMPP框架下微信项目总结(5)花名册获取(好友列表)
---->概念 ---->添加花名册 ps:添加花名册,启动: 客户端发送请求到服务器获取好友列表信息,同时在项目中创建数据表,并保存好友列表到数据表中. ---->获取服务器保存好 ...
随机推荐
- vc获取特殊路径(SpecialFolder)
%SystemDrive% 操作系统所在的分区号.如 C: %SystemRoot% 操作系统根目录.如 C:\WINDOWS %windir% 操作系统根目录.如 C:\WINDOWS %ALLUS ...
- 【Pro ASP.NET MVC 3 Framework】.学习笔记.3.MVC的主要工具-单元测试
IProductRepository接口定义了一个仓库,我们通过它获得.更新Product对象.IPriceReducer接口指定了一个功能,它将要对所有的Products实施,通过一个参数,降低他们 ...
- cut DEMO
分割后得到列: cat /etc/passwd|head -n 5 | cut -d : -f 1,6
- HLS视频直播
HTTP Live Streaming (HLS) 苹果官方对于视频直播服务提出了 HLS 解决方案,该方案主要适用范围在于: 使用 iPhone .iPod touch. iPad 以及 Apple ...
- C#:关联程序和文件
一.关联代码 /// <summary> /// 关联程序和类型 /// </summary> private void RegFileExt() { try { string ...
- dedecms的title怎么优化?
(1)首页:index.htm 模板:<title>k1,k2,k3 {dede:global.cfg_webname/}</title> 规则:3个关键词+网站名称 示例:& ...
- hdu1016 Prime Ring Problem
dfs,用全局数组和变量保存并更新当前状态. 答案可以直接在搜索结束时打印,n为奇数时方案数为0. acm.hdu.edu.cn/showproblem.php?pid=1016 #include & ...
- 人活着系列之平方数 分类: sdutOJ 2015-06-22 17:10 7人阅读 评论(0) 收藏
人活着系列之平方数 Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^ 题目描述 偶然和必然?命运与意志?生与死?理性与情感?价值与非价值?在&quo ...
- 2016 Al-Baath University Training Camp Contest-1 B
Description A group of junior programmers are attending an advanced programming camp, where they lea ...
- 2016年11月20日 星期日 --出埃及记 Exodus 20:11
2016年11月20日 星期日 --出埃及记 Exodus 20:11 For in six days the LORD made the heavens and the earth, the sea ...