コード例 #1
0
        public void PageSetupDialog_Reset_InvokeComplex_Success()
        {
            var container = new Container();
            var dialog    = new PageSetupDialog
            {
                AllowMargins     = false,
                AllowOrientation = false,
                AllowPaper       = false,
                AllowPrinter     = false,
                Document         = new PrintDocument(),
                MinMargins       = new Margins(1, 2, 3, 4),
                ShowHelp         = true,
                ShowNetwork      = false,
                Tag = "tag"
            };

            container.Add(dialog);

            dialog.Reset();
            Assert.True(dialog.AllowMargins);
            Assert.True(dialog.AllowOrientation);
            Assert.True(dialog.AllowPaper);
            Assert.True(dialog.AllowPrinter);
            Assert.Same(container, dialog.Container);
            Assert.Null(dialog.Document);
            Assert.False(dialog.EnableMetric);
            Assert.Equal(new Margins(0, 0, 0, 0), dialog.MinMargins);
            Assert.Same(dialog.MinMargins, dialog.MinMargins);
            Assert.Null(dialog.PageSettings);
            Assert.Null(dialog.PrinterSettings);
            Assert.False(dialog.ShowHelp);
            Assert.True(dialog.ShowNetwork);
            Assert.NotNull(dialog.Site);
            Assert.Equal("tag", dialog.Tag);
        }
コード例 #2
0
 public void PageSetupDialog_Reset_InvokeDefault_Success()
 {
     using var dialog = new PageSetupDialog();
     dialog.Reset();
     Assert.True(dialog.AllowMargins);
     Assert.True(dialog.AllowOrientation);
     Assert.True(dialog.AllowPaper);
     Assert.True(dialog.AllowPrinter);
     Assert.Null(dialog.Container);
     Assert.Null(dialog.Document);
     Assert.False(dialog.EnableMetric);
     Assert.Equal(new Margins(0, 0, 0, 0), dialog.MinMargins);
     Assert.Same(dialog.MinMargins, dialog.MinMargins);
     Assert.Null(dialog.PageSettings);
     Assert.Null(dialog.PrinterSettings);
     Assert.False(dialog.ShowHelp);
     Assert.True(dialog.ShowNetwork);
     Assert.Null(dialog.Site);
     Assert.Null(dialog.Tag);
 }
コード例 #3
0
        private void pageSetupTool_Click(object sender, EventArgs e)
        {
            PageSetupDialog setupDlg = new PageSetupDialog();
            PrintDocument   printDoc = new PrintDocument();
            PrintDialog     prin     = new PrintDialog();

            printDoc.DocumentName     = "hello";
            setupDlg.Document         = printDoc;
            setupDlg.AllowMargins     = false;
            setupDlg.AllowOrientation = false;
            setupDlg.AllowPaper       = false;
            setupDlg.AllowPrinter     = false;
            setupDlg.Reset();
            if (setupDlg.ShowDialog() == DialogResult.OK)
            {
                printDoc.DefaultPageSettings = setupDlg.PageSettings;
                printDoc.PrinterSettings     =
                    setupDlg.PrinterSettings;
            }


            //pages.ShowDialog();
            //  pages.ShowDialog();
        }