看看这个行么 [DllImport("shell32.dll", CharSet=CharSet.Auto)] public static extern Int32 SHInvokePrinterCommand( IntPtr hwnd,// Handle of the window that will be used as the parent of any windows // or dialog boxes that are created during the operation. UInt32 uAction, // A value that determines the type of printer operation that will be // performed. [MarshalAs(UnmanagedType.LPWStr)] String lpBuf1, // Address of a null_terminated string that contains additional // information for the printer command. [MarshalAs(UnmanagedType.LPWStr)] String lpBuf2, // Address of a null-terminated string that contains additional // information for the printer command. Int32 fModal); // value that determines whether SHInvokePrinterCommand should return // after initializing the command or wait until the command is completed.
PrintDocument对象的DefaultSetting属性里设置就可以了
[DllImport("shell32.dll", CharSet=CharSet.Auto)]
public static extern Int32 SHInvokePrinterCommand(
IntPtr hwnd,// Handle of the window that will be used as the parent of any windows
// or dialog boxes that are created during the operation.
UInt32 uAction, // A value that determines the type of printer operation that will be
// performed.
[MarshalAs(UnmanagedType.LPWStr)]
String lpBuf1, // Address of a null_terminated string that contains additional
// information for the printer command.
[MarshalAs(UnmanagedType.LPWStr)]
String lpBuf2, // Address of a null-terminated string that contains additional
// information for the printer command.
Int32 fModal); // value that determines whether SHInvokePrinterCommand should return
// after initializing the command or wait until the command is completed.
下次程序启动是再设置打印属性就可以了。