This repository has been archived by the owner on Oct 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form2.cs
47 lines (43 loc) · 1.8 KB
/
Form2.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Printing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.LookAndFeel;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Preview;
using DevExpress.XtraPrinting.Preview;
namespace GridPrinting {
public partial class MyPrintDialog : PrintEditorForm {
public MyPrintDialog()
: base() {
}
protected override void OnLoad(EventArgs e) {
base.OnLoad(e);
ImageComboBoxEdit comboBox = typeof(PrintEditorForm).GetField("icbInstalledPrinters", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetField | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance).GetValue(this) as ImageComboBoxEdit;
if(comboBox != null)
foreach(object item in comboBox.Properties.Items)
if(item.ToString() == "Microsoft XPS Document Writer") {
comboBox.Properties.Items.Remove(item);
return;
}
}
}
public class MyRunner : PrintDialogRunner {
//public override DialogResult Run(PrintDocument document, UserLookAndFeel lookAndFeel, IWin32Window owner) {
//
//}
public override DialogResult Run(PrintDocument document, UserLookAndFeel lookAndFeel, IWin32Window owner, PrintDialogAllowFlags flags)
{
using(MyPrintDialog dialog = new MyPrintDialog()) {
dialog.Document = document;
dialog.LookAndFeel.ParentLookAndFeel = lookAndFeel;
return DevExpress.XtraPrinting.Native.DialogRunner.ShowDialog(dialog, owner);
}
}
}
}