现应业务要求,需要将用户设置的打印机配置保存下来,然后程序自动设置打印之后,再将用户前面的配置给设置回去
目前探索的方法是:
配置保存:
Const strSettingFile As String = "D:\PrintSettings.dat"
Dim objWriter As New System.IO.BinaryWriter(System.IO.File.Open(strSettingFile, System.IO.FileMode.Create))
Viewer1.Document.Printer.SaveSettings(objWriter)
objWriter.Close()
Viewer1.Document.ResetPrinter()
配置读取:
If (System.IO.File.Exists(strSettingFile)) Then
Dim objReader As System.IO.BinaryReader = New System.IO.BinaryReader(System.IO.File.Open(strSettingFile, System.IO.FileMode.Open))
Viewer1.Document.Printer.LoadSettings(objReader)
objReader.Close()
End If
实行后配置无法导回去,打印机还是Reset之后的状态,不知道是哪里出问题,
请问SaveSettings和LoadSettings事件如何能够正常使用,谢谢!