mirror of
https://github.com/Rayerd/dfl.git
synced 2025-04-26 21:30:25 +03:00
Update commondialog example.
This commit is contained in:
parent
a968239ea9
commit
5cf194a5b7
1 changed files with 17 additions and 12 deletions
|
@ -189,18 +189,22 @@ class MainForm : Form
|
||||||
|
|
||||||
private void doPrintDialog(Control sender, EventArgs e)
|
private void doPrintDialog(Control sender, EventArgs e)
|
||||||
{
|
{
|
||||||
PrintRangeSettings printRange = _printDialog.document.printerSettings.printRange;
|
_printDialog.document.printRange ~= (PrintDocument doc, PrintRangeEventArgs e) {
|
||||||
static if (0)
|
final switch (e.printRange.kind)
|
||||||
{
|
{
|
||||||
// BUG: Don't work now.
|
case PrintRangeKind.ALL_PAGES:
|
||||||
printRange.kind = PrintRangeKind.SELECTION; // But overriden by dialog.
|
e.printRange.addPrintRange(PrintRange(1, 2));
|
||||||
printRange.addPrintRange(PrintRange(1, 1)); // Example as selected pages.
|
break;
|
||||||
}
|
case PrintRangeKind.SELECTION:
|
||||||
else
|
e.printRange.addPrintRange(PrintRange(1, 1));
|
||||||
{
|
break;
|
||||||
printRange.kind = PrintRangeKind.ALL_PAGES; // But overriden by dialog.
|
case PrintRangeKind.CURRENT_PAGE:
|
||||||
printRange.addPrintRange(PrintRange(1, 2)); // Example as all pages.
|
e.printRange.addPrintRange(PrintRange(2, 2));
|
||||||
}
|
break;
|
||||||
|
case PrintRangeKind.SOME_PAGES:
|
||||||
|
// The page range is determined by the printer dialog, so we don't do anything here.
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
_printDialog.document.beginPrint ~= (PrintDocument doc, PrintEventArgs e) {
|
_printDialog.document.beginPrint ~= (PrintDocument doc, PrintEventArgs e) {
|
||||||
// Do something.
|
// Do something.
|
||||||
|
@ -208,6 +212,7 @@ class MainForm : Form
|
||||||
|
|
||||||
_printDialog.document.queryPageSettings ~= (PrintDocument doc, QueryPageSettingsEventArgs e) {
|
_printDialog.document.queryPageSettings ~= (PrintDocument doc, QueryPageSettingsEventArgs e) {
|
||||||
// User modify page settings here.
|
// User modify page settings here.
|
||||||
|
// TODO: Paper orientation cannot be changed.
|
||||||
};
|
};
|
||||||
|
|
||||||
_printDialog.document.printPage ~= (PrintDocument doc, PrintPageEventArgs e) {
|
_printDialog.document.printPage ~= (PrintDocument doc, PrintPageEventArgs e) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue