C# winform代码如何实现设置默认打印机

2024-12-22 13:09:19
推荐回答(1个)
回答1:

实例化winspool.drv对象,然后调用SetDefaultPrinter方法来设置默认打印机
[DllImport("winspool.drv", CharSet = CharSet.Auto, SetLastError = true)]
private static extern long SetDefaultPrinter(string pszPrinter);