该问题的其他答,关于打印机的问 重庆兴道盛电子有限公司 产品订购热线:023-86792938 15023223043 | |||||||
|
| 网站首页 | 公司信息 | 产品信息 | 新闻动态 | 下载中心 | 业界知识 | 联系我们 | 诚聘精英 | 证卡部 | 博客 | 商情发布 | |
![]() |
位置: 重庆兴道盛电子有限公司 >> 商情发布 >> 其他商情 >> 正文 |
|
|||||
-C#winform代码如何实现设置默认打印机 |
|||||
C# winform代码如何实现设置默认打印机关于打印机的问题: 该问题的其他答案:
最佳答案
实例化winspool.drv对象,然后调用SetDefaultPrinter方法来设置默认打印机
[DllImport("winspool.drv", CharSet = CharSet.Auto,3.15消费者权益日 小编支招选购称心空调, SetLastError = true)]
private static extern long SetDefaultPrinter(string pszPrinter);
追问
using System.ComponentModel;
using System.Drawing;
using System.Runtime.InteropServices;
{
public partial class Form1 : Form
{public Form1()
{ InitializeComponent(); }
[DllImport("winspool.drv")]
public static extern bool SetDefaultPrinter(string Name);
private void button1_Click(object sender, EventArgs e) {SetDefaultPrinter("My Microsoft XPS Document Writer");}}}
向TA求助
回答者: meepo_demon | 三级采纳率:15% 擅长领域: 暂未定制 参加的活动: 暂时没有参加的活动
相关内容
|
|||||
|
*重庆兴道盛电子有限公司 |
|