Esempio n. 1
0
        private void PrePageSetup()
        {
            printDocument.OriginAtMargins = true;
            pageSetupDlg.Document         = printDocument;

            var pm = MapPrintDocument.PhysicalMargins(pageSetupDlg.PageSettings);

            pageSetupDlg.MinMargins = new Margins(pm.Width, pm.Width, pm.Height, pm.Height);
        }
Esempio n. 2
0
        private void SetPrintAreaText()
        {
            var im = printDocument.Image;

            PageSize = MapPrintDocument.GetPageSize(pageSetupDlg.PageSettings ?? printDocument.DefaultPageSettings);
            NumPages = printDocument.GetNumPages(PageSize);

            var pa = printDocument.PrintArea;

            printAreaLabel.Text = String.Format(R.PrintAreaFmt, pa.X, pa.Y, pa.Width, pa.Height, NumPages);

            pictureBox1.Invalidate();
        }
Esempio n. 3
0
        public CMainForm()
        {
            InitializeComponent();

            panel1.ZoomEvent        += panel1_OnZoom;
            printDocument            = new MapPrintDocument();
            printDocument.PrintPage += printDocument_PrintPage;

            const int defMargins = (int)(10 * 100 / 25.4m) + 1;  // 10mm in 1/100 of the inch

            printDocument.DefaultPageSettings.Margins = new System.Drawing.Printing.Margins(defMargins, defMargins, defMargins, defMargins);

            crossHair = new Cursor(GetType(), "crosshair.cur");
            Text      = AboutBox.AssemblyProduct + " " + AboutBox.AssemblyVersion;
        }
Esempio n. 4
0
        private bool PageSetupSucceed(PrinterSettings ps, PageSettings pageSett)
        {
            printDocument.PrinterSettings     = ps;
            printDocument.DefaultPageSettings = pageSett;

            PageSize = MapPrintDocument.GetPageSize(pageSett);
            if (OverlapSmallEnough(printDocument.Overlap))
            {
                return(true);
            }

            float ovrl = (float)Math.Floor(Math.Min(PageSize.Width, PageSize.Height) * 25.4 / 100 / 4);  // 1/4 of

            printDocument.Overlap = ovrl;
            overlap.Text          = Float2Text(ovrl);

            MessageBox.Show(R.OverlapAdjusted, R.WarningTitle, MessageBoxButtons.OK, MessageBoxIcon.None);

            return(false);
        }
Esempio n. 5
0
        public void Test()
        {
            using (var bm = new Bitmap(2000, 1000))
                using (var pd = new MapPrintDocument())
                {
                    bm.SetResolution(150, 150);
                    pd.SetImage(bm);
                    pd.PrintArea = new Rectangle(300, 0, 1700, 1000);

                    var pageSize = new Size(900, 1300);
                    int n        = pd.GetNumPages(pageSize);
                    sb.AppendLine("pages: " + n.ToString());

                    for (int i = 0; i < n; i++)
                    {
                        var r = pd.GetSrcRect(i, pageSize);
                        sb.AppendLine("page " + i.ToString() + ": " + r.ToString());
                    }
                }
        }