public void ShowPrintPreviewControl_BackColorIsCorrect(int customBackColorArgb, bool isHighContrast, int expectedBackColorArgb)
        {
            var control = new PrintPreviewControl();

            if (customBackColorArgb != emptyColorArgb)
            {
                control.BackColor = Color.FromArgb(customBackColorArgb);
            }

            int actualBackColorArgb = control.GetTestAccessor().GetBackColor(isHighContrast).ToArgb();

            Assert.Equal(expectedBackColorArgb, actualBackColorArgb);

            // Default AppWorkSpace color in HC theme does not allow to follow HC standards.
            if (isHighContrast)
            {
                Assert.True(!appWorkSpaceHcColorArgb.Equals(actualBackColorArgb));
            }
        }
Exemplo n.º 2
0
        public LetterPrint(PrintDocument document)
        {
            preview = new PrintPreviewControl {
                Dock     = DockStyle.Fill,
                Document = document,
                Zoom     = 0.85
            };

            int x = (Screen.PrimaryScreen.Bounds.Width - CommandButton.DefaultWidth) / 2;

            close = new CommandButton(Resources.Back)
            {
                Location = new Point(x - CommandButton.DefaultWidth - 10, 0),
            };
            close.Click += (s, e) => {
                this.Close();
            };

            print = new CommandButton(Resources.Print)
            {
                Location = new Point(x + CommandButton.DefaultWidth + 10, 0),
            };
            print.Click += (s, e) => {
                if (DB.Execute.CanPrint(document.DocumentName))
                {
#if DEBUG
                    MessageBox.Show("print");
#else
                    document.Print();
#endif
                }
            };

            panel = new Panel {
                Dock   = DockStyle.Bottom,
                Height = CommandButton.DefaultHeight + 2,
            };
            panel.Controls.Add(close);
            panel.Controls.Add(print);

            this.Controls.Add(preview);
            this.Controls.Add(panel);
        }
Exemplo n.º 3
0
        private void _pnlPrinting_OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            ContentPresenter cp = (ContentPresenter)sender;
            var ef = ((MainWindow)Application.Current.MainWindow).Data.EditorFrame;

            if (ef == null || ef.XmlEditor == null || ef.XSDocument == null)
            {
                cp.Content = new Label {
                    Content = "No file loaded"
                };
                return;
            }

            PageSettings pageSettings = new PageSettings {
                Margins = new Margins(40, 40, 40, 40)
            };

            PrintQueue  printQueue  = LocalPrintServer.GetDefaultPrintQueue();
            PrintTicket printTicket = printQueue.DefaultPrintTicket;

            PrintPreviewControl printPreview = new PrintPreviewControl();

            printPreview.DocumentViewer.FitToMaxPagesAcross(1);

            printPreview.DocumentViewer.PrintQueue = printQueue;

            if (pageSettings.Landscape)
            {
                printTicket.PageOrientation = PageOrientation.Landscape;
            }

            printPreview.DocumentViewer.PrintTicket = printTicket;
            printPreview.DocumentViewer.PrintQueue.DefaultPrintTicket.PageOrientation = printTicket.PageOrientation;

            printPreview.LoadDocument(Printing.CreateDocumentPaginatorToPrint(ef.XmlEditor, pageSettings, printTicket, ef.XSDocument.Filename));

            // this is stupid, but must be done to view a whole page:
            DocumentViewer.FitToMaxPagesAcrossCommand.Execute("1", printPreview.DocumentViewer);

            cp.Content = printPreview;
        }
        // 印刷ボタンハンドラ
        private void SettingPrintPreviewDialog_toolStripButtonPrintClick(object sender, EventArgs e)
        {
            if (Document == null)
            {
                return;
            }

            if (Document.PrinterSettings == null)
            {
                Document.PrinterSettings = new PrinterSettings();
            }
            PrintDialog.PrinterSettings = Document.PrinterSettings;
            PrintDialog.Document        = Document;
            PrintDialog.PrinterSettings = Document.PrinterSettings;
            if (PrintDialog.ShowDialog() == DialogResult.OK)
            {
                Document.Print();
                Document.PrinterSettings.PrintRange = PrintRange.AllPages;
                PrintPreviewControl.InvalidatePreview();
            }
        }
Exemplo n.º 5
0
	public MainForm ()
	{
		// 
		// _printPreviewControl
		// 
		_printPreviewControl = new PrintPreviewControl ();
		_printPreviewControl.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
		_printPreviewControl.Dock = DockStyle.Bottom;
		_printPreviewControl.Height = 295;
		_printPreviewControl.TabIndex = 0;
		_printPreviewControl.Zoom = 1;
		Controls.Add (_printPreviewControl);
		// 
		// _printButton
		// 
		_zoomTrackBar = new TrackBar ();
		_zoomTrackBar.Location = new Point (12, 12);
		_zoomTrackBar.Maximum = 100;
		_zoomTrackBar.Minimum = 1;
		_zoomTrackBar.Size = new Size (330, 23);
		_zoomTrackBar.TabIndex = 1;
		_zoomTrackBar.Text = "Zoom";
		_zoomTrackBar.Value = 10;
		_zoomTrackBar.ValueChanged += new EventHandler (ZoomTrackBar_ValueChanged);
		Controls.Add (_zoomTrackBar);
		// 
		// _printDocument
		// 
		_printDocument = new PrintDocument ();
		_printDocument.PrintPage += new PrintPageEventHandler (PrintDocument_PrintPage);
		_printPreviewControl.Document = _printDocument;
		// 
		// MainForm
		// 
		ClientSize = new Size (350, 350);
		Location = new Point (200, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #81744";
		Load += new EventHandler (MainForm_Load);
	}
Exemplo n.º 6
0
        private void frmChargeCheck_Load(object sender, System.EventArgs e)
        {
            this.lblBillNo.Text = "";
            ((clsControlChargeCheck)this.objController).m_frmLoad();
            ((System.Windows.Forms.DataGridTextBoxColumn)(this.DgChargeCheck.TableStyles[0].GridColumnStyles[6])).TextBox.Enabled = true;
            ((System.Windows.Forms.DataGridTextBoxColumn)(this.DgChargeCheck.TableStyles[0].GridColumnStyles[6])).TextBox.Enter  += new EventHandler(TextBox_Enter);
            blis = clsMain.m_blGetCollocate("0026");
            PrintPreviewControl ppc = null;

            foreach (System.Windows.Forms.Control c in this.printPreviewDialog1.Controls)
            {
                if (c is PrintPreviewControl)
                {
                    ppc = (PrintPreviewControl)c;
                }
            }
            ppc.Zoom = 1;

            if (this.IsModify == "*")
            {
                this.m_cobChang.Enabled = false;
            }
        }
Exemplo n.º 7
0
	public MainForm ()
	{
		// 
		// _printPreviewControl
		// 
		_printPreviewControl = new PrintPreviewControl ();
		_printPreviewControl.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
		_printPreviewControl.Dock = DockStyle.Bottom;
		_printPreviewControl.Height = 295;
		_printPreviewControl.TabIndex = 0;
		_printPreviewControl.Zoom = 1;
		Controls.Add (_printPreviewControl);
		// 
		// _printButton
		// 
		_printButton = new Button ();
		_printButton.Location = new Point (12, 12);
		_printButton.Size = new Size (75, 23);
		_printButton.TabIndex = 1;
		_printButton.Text = "Print";
		_printButton.Click += new System.EventHandler (PrintButton_Click);
		Controls.Add (_printButton);
		// 
		// _printDocument
		// 
		_printDocument = new PrintDocument ();
		_printDocument.PrintPage += new PrintPageEventHandler (PrintDocument_PrintPage);
		_printPreviewControl.Document = _printDocument;
		// 
		// MainForm
		// 
		ClientSize = new Size (350, 350);
		Location = new Point (200, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #81708";
		Load += new EventHandler (MainForm_Load);
	}
Exemplo n.º 8
0
        public void StartPage()
        {
            if (PrinterSettings.InstalledPrinters.Count == 0)
            {
                Assert.Ignore("The test depends on printer being available.");
            }

            using (Form f = new Form())
            {
                PrintPreviewControl p = new PrintPreviewControl();
                f.Controls.Add(p);
                f.Show();

                Assert.AreEqual(0, p.StartPage);
                Assert.AreEqual(1, p.Rows);
                Assert.AreEqual(1, p.Columns);
                p.StartPage = 4;
                Assert.AreEqual(4, p.StartPage);

                PrintDocument document    = new PrintDocument();
                int           page_number = 0;
                int           page_count  = 1;
                document.BeginPrint += (sender, e) => page_number = 0;
                document.PrintPage  += (sender, e) => e.HasMorePages = ++page_number < page_count;
                var printController = document.PrintController;

                p.Document = document;
                p.Refresh();
                Assert.AreEqual(0, p.StartPage);

                page_count = 8;
                p.InvalidatePreview();
                p.Refresh();
                Assert.AreEqual(4, p.StartPage);
                Assert.AreEqual(printController, document.PrintController);
            }
        }
Exemplo n.º 9
0
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ControlViewer));
     this.printPreviewControl       = new System.Windows.Forms.PrintPreviewControl();
     this.toolStrip1                = new System.Windows.Forms.ToolStrip();
     this.printToolStripButton      = new System.Windows.Forms.ToolStripButton();
     this.toolStripButtonPrintSetup = new System.Windows.Forms.ToolStripButton();
     this.toolStripSeparator        = new System.Windows.Forms.ToolStripSeparator();
     this.toolStripLabel1           = new System.Windows.Forms.ToolStripLabel();
     this.cbxZoom             = new System.Windows.Forms.ToolStripComboBox();
     this.btnDoublePage       = new System.Windows.Forms.ToolStripButton();
     this.btnSinglePage       = new System.Windows.Forms.ToolStripButton();
     this.btnQuaterPage       = new System.Windows.Forms.ToolStripButton();
     this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
     this.BtnFirstPage        = new System.Windows.Forms.ToolStripButton();
     this.BtnPriorPage        = new System.Windows.Forms.ToolStripButton();
     this.EdtPage             = new System.Windows.Forms.ToolStripTextBox();
     this.BtnNextPage         = new System.Windows.Forms.ToolStripButton();
     this.BtnLasPage          = new System.Windows.Forms.ToolStripButton();
     this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
     this.helpToolStripButton = new System.Windows.Forms.ToolStripButton();
     this.statusStrip1        = new System.Windows.Forms.StatusStrip();
     this.toolStripStatusLblPagesNumerNumber = new System.Windows.Forms.ToolStripStatusLabel();
     this.printDialog1 = new System.Windows.Forms.PrintDialog();
     this.toolStrip1.SuspendLayout();
     this.statusStrip1.SuspendLayout();
     this.SuspendLayout();
     //
     // printPreviewControl
     //
     this.printPreviewControl.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.printPreviewControl.Location = new System.Drawing.Point(0, 25);
     this.printPreviewControl.Name     = "printPreviewControl";
     this.printPreviewControl.Size     = new System.Drawing.Size(570, 321);
     this.printPreviewControl.TabIndex = 0;
     //
     // toolStrip1
     //
     this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
         this.printToolStripButton,
         this.toolStripButtonPrintSetup,
         this.toolStripSeparator,
         this.toolStripLabel1,
         this.cbxZoom,
         this.btnDoublePage,
         this.btnSinglePage,
         this.btnQuaterPage,
         this.toolStripSeparator2,
         this.BtnFirstPage,
         this.BtnPriorPage,
         this.EdtPage,
         this.BtnNextPage,
         this.BtnLasPage,
         this.toolStripSeparator1,
         this.helpToolStripButton
     });
     this.toolStrip1.Location = new System.Drawing.Point(0, 0);
     this.toolStrip1.Name     = "toolStrip1";
     this.toolStrip1.Size     = new System.Drawing.Size(570, 25);
     this.toolStrip1.TabIndex = 1;
     this.toolStrip1.Text     = "toolStrip1";
     //
     // printToolStripButton
     //
     this.printToolStripButton.DisplayStyle          = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
     this.printToolStripButton.Image                 = global::Properties.Resources.printToolStripButton_Image;
     this.printToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.printToolStripButton.Name = "printToolStripButton";
     this.printToolStripButton.Size = new System.Drawing.Size(23, 22);
     this.printToolStripButton.Text = "打印";
     //
     // toolStripButtonPrintSetup
     //
     this.toolStripButtonPrintSetup.DisplayStyle          = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
     this.toolStripButtonPrintSetup.Image                 = global::Properties.Resources.PrintSetupHS;
     this.toolStripButtonPrintSetup.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.toolStripButtonPrintSetup.Name   = "toolStripButtonPrintSetup";
     this.toolStripButtonPrintSetup.Size   = new System.Drawing.Size(23, 22);
     this.toolStripButtonPrintSetup.Text   = "打印设置";
     this.toolStripButtonPrintSetup.Click += new System.EventHandler(this.toolStripButtonPrintSetup_Click);
     //
     // toolStripSeparator
     //
     this.toolStripSeparator.Name = "toolStripSeparator";
     this.toolStripSeparator.Size = new System.Drawing.Size(6, 25);
     //
     // toolStripLabel1
     //
     this.toolStripLabel1.Name = "toolStripLabel1";
     this.toolStripLabel1.Size = new System.Drawing.Size(53, 22);
     this.toolStripLabel1.Text = "显示比例";
     //
     // cbxZoom
     //
     this.cbxZoom.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     this.cbxZoom.Name          = "cbxZoom";
     this.cbxZoom.Size          = new System.Drawing.Size(75, 25);
     //
     // btnDoublePage
     //
     this.btnDoublePage.DisplayStyle          = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
     this.btnDoublePage.Image                 = ((System.Drawing.Image)(resources.GetObject("btnDoublePage.Image")));
     this.btnDoublePage.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.btnDoublePage.Name   = "btnDoublePage";
     this.btnDoublePage.Size   = new System.Drawing.Size(23, 22);
     this.btnDoublePage.Text   = "双页";
     this.btnDoublePage.Click += new System.EventHandler(this.btnDoublePage_Click);
     //
     // btnSinglePage
     //
     this.btnSinglePage.DisplayStyle          = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
     this.btnSinglePage.Image                 = ((System.Drawing.Image)(resources.GetObject("btnSinglePage.Image")));
     this.btnSinglePage.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.btnSinglePage.Name   = "btnSinglePage";
     this.btnSinglePage.Size   = new System.Drawing.Size(23, 22);
     this.btnSinglePage.Text   = "单页";
     this.btnSinglePage.Click += new System.EventHandler(this.btnSinglePage_Click);
     //
     // btnQuaterPage
     //
     this.btnQuaterPage.DisplayStyle          = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
     this.btnQuaterPage.Image                 = ((System.Drawing.Image)(resources.GetObject("btnQuaterPage.Image")));
     this.btnQuaterPage.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.btnQuaterPage.Name   = "btnQuaterPage";
     this.btnQuaterPage.Size   = new System.Drawing.Size(23, 22);
     this.btnQuaterPage.Text   = "四页";
     this.btnQuaterPage.Click += new System.EventHandler(this.btnQuaterPage_Click);
     //
     // toolStripSeparator2
     //
     this.toolStripSeparator2.Name = "toolStripSeparator2";
     this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25);
     //
     // BtnFirstPage
     //
     this.BtnFirstPage.DisplayStyle          = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
     this.BtnFirstPage.Image                 = ((System.Drawing.Image)(resources.GetObject("BtnFirstPage.Image")));
     this.BtnFirstPage.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.BtnFirstPage.Name   = "BtnFirstPage";
     this.BtnFirstPage.Size   = new System.Drawing.Size(23, 22);
     this.BtnFirstPage.Text   = "首页";
     this.BtnFirstPage.Click += new System.EventHandler(this.BtnFirstPage_Click);
     //
     // BtnPriorPage
     //
     this.BtnPriorPage.DisplayStyle          = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
     this.BtnPriorPage.Image                 = ((System.Drawing.Image)(resources.GetObject("BtnPriorPage.Image")));
     this.BtnPriorPage.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.BtnPriorPage.Name   = "BtnPriorPage";
     this.BtnPriorPage.Size   = new System.Drawing.Size(23, 22);
     this.BtnPriorPage.Text   = "上页";
     this.BtnPriorPage.Click += new System.EventHandler(this.BtnPriorPage_Click);
     //
     // EdtPage
     //
     this.EdtPage.Name = "EdtPage";
     this.EdtPage.Size = new System.Drawing.Size(40, 25);
     //
     // BtnNextPage
     //
     this.BtnNextPage.DisplayStyle          = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
     this.BtnNextPage.Image                 = ((System.Drawing.Image)(resources.GetObject("BtnNextPage.Image")));
     this.BtnNextPage.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.BtnNextPage.Name   = "BtnNextPage";
     this.BtnNextPage.Size   = new System.Drawing.Size(23, 22);
     this.BtnNextPage.Text   = "下页";
     this.BtnNextPage.Click += new System.EventHandler(this.BtnNextPage_Click);
     //
     // BtnLasPage
     //
     this.BtnLasPage.DisplayStyle          = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
     this.BtnLasPage.Image                 = ((System.Drawing.Image)(resources.GetObject("BtnLasPage.Image")));
     this.BtnLasPage.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.BtnLasPage.Name   = "BtnLasPage";
     this.BtnLasPage.Size   = new System.Drawing.Size(23, 22);
     this.BtnLasPage.Text   = "尾页";
     this.BtnLasPage.Click += new System.EventHandler(this.BtnLasPage_Click);
     //
     // toolStripSeparator1
     //
     this.toolStripSeparator1.Name = "toolStripSeparator1";
     this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
     //
     // helpToolStripButton
     //
     this.helpToolStripButton.DisplayStyle          = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
     this.helpToolStripButton.Image                 = global::Properties.Resources.helpToolStripButton_Image;
     this.helpToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.helpToolStripButton.Name = "helpToolStripButton";
     this.helpToolStripButton.Size = new System.Drawing.Size(23, 22);
     this.helpToolStripButton.Text = "帮助";
     //
     // statusStrip1
     //
     this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
         this.toolStripStatusLblPagesNumerNumber
     });
     this.statusStrip1.Location = new System.Drawing.Point(0, 346);
     this.statusStrip1.Name     = "statusStrip1";
     this.statusStrip1.Size     = new System.Drawing.Size(570, 22);
     this.statusStrip1.TabIndex = 2;
     this.statusStrip1.Text     = "statusStrip1";
     //
     // toolStripStatusLblPagesNumerNumber
     //
     this.toolStripStatusLblPagesNumerNumber.Name = "toolStripStatusLblPagesNumerNumber";
     this.toolStripStatusLblPagesNumerNumber.Size = new System.Drawing.Size(47, 17);
     this.toolStripStatusLblPagesNumerNumber.Text = "1 de 10";
     //
     // printDialog1
     //
     this.printDialog1.AllowCurrentPage = true;
     this.printDialog1.AllowSomePages   = true;
     this.printDialog1.PrintToFile      = true;
     this.printDialog1.ShowHelp         = true;
     this.printDialog1.UseEXDialog      = true;
     //
     // ControlViewer
     //
     this.Controls.Add(this.printPreviewControl);
     this.Controls.Add(this.statusStrip1);
     this.Controls.Add(this.toolStrip1);
     this.Name = "ControlViewer";
     this.Size = new System.Drawing.Size(570, 368);
     this.toolStrip1.ResumeLayout(false);
     this.toolStrip1.PerformLayout();
     this.statusStrip1.ResumeLayout(false);
     this.statusStrip1.PerformLayout();
     this.ResumeLayout(false);
     this.PerformLayout();
 }
Exemplo n.º 10
0
        public void printpage(bool printed)
        {
            document.Sections.Clear();



            section = document.AddSection();

            SizeF sf = new SizeF();

            for (int i = 0; i < mReportApp.mPagelist.Count; i++)
            {
                if (mReportApp.mPagelist[i].Name == mReportApp.pagesize)
                {
                    sf = mReportApp.mPagelist[i].size;
                }
            }

            section.PageSetup.PageSize       = sf;
            section.PageSetup.Margins.Top    = mReportApp.Margins;
            section.PageSetup.Margins.Bottom = mReportApp.Margins / 2;
            section.PageSetup.Margins.Left   = mReportApp.Margins;
            section.PageSetup.Margins.Right  = mReportApp.Margins;

            if (mReportApp.Landscape == true)
            {
                section.PageSetup.Orientation = PageOrientation.Landscape;
            }
            else
            {
                section.PageSetup.Orientation = PageOrientation.Portrait;
            }



            HeaderFooter header = section.HeadersFooters.Header;
            HeaderFooter footer = section.HeadersFooters.Footer;


            Paragraph headerParagraph = header.AddParagraph();


            if (mReportApp.headerposition == 0)
            {
                headerParagraph.Format.HorizontalAlignment
                    = Spire.Doc.Documents.HorizontalAlignment.Left;
            }
            else if (mReportApp.headerposition == 1)
            {
                headerParagraph.Format.HorizontalAlignment
                    = Spire.Doc.Documents.HorizontalAlignment.Center;
            }
            else if (mReportApp.headerposition == 2)
            {
                headerParagraph.Format.HorizontalAlignment
                    = Spire.Doc.Documents.HorizontalAlignment.Right;
            }



            headerParagraph.Format.Borders.Bottom.BorderType
                = Spire.Doc.Documents.BorderStyle.Single;
            headerParagraph.Format.Borders.Bottom.Space = 0.05F;

            mReportApp.ChangeReportValue();

            for (int i = 0; i < mReportApp.mreportheader.Count; i++)
            {
                if (mReportApp.mreportheader[i].kind == 0)
                {
                    string s = "";
                    s = s.PadLeft(Convert.ToInt16(mReportApp.mreportheader[i].mspace), Convert.ToChar(" "));
                    if (mReportApp.mreportheader[i].showcaption == false)
                    {
                        s = s + mReportApp.mreportheader[i].txtresult;
                    }
                    else
                    {
                        s = s + mReportApp.mreportheader[i].Name + ":" + mReportApp.mreportheader[i].txtresult;
                    }



                    TextRange text = headerParagraph.AppendText(s);
                    text.CharacterFormat.FontName = mReportApp.mreportheader[i].font.Name;
                    text.CharacterFormat.FontSize = mReportApp.mreportheader[i].font.Size;
                    text.CharacterFormat.Italic   = mReportApp.mreportheader[i].font.Italic;
                    text.CharacterFormat.Bold     = mReportApp.mreportheader[i].font.Bold;
                }
                if (mReportApp.mreportheader[i].kind == 2)
                {
                    if (mReportApp.mreportheader[i].filename.Trim() == "")
                    {
                    }
                    else
                    {
                        string s = "";
                        s = s.PadLeft(Convert.ToInt16(mReportApp.mreportheader[i].mspace), Convert.ToChar(" "));

                        TextRange text = headerParagraph.AppendText(s);
                        text.CharacterFormat.FontName = mReportApp.mreportheader[i].font.Name;
                        text.CharacterFormat.FontSize = mReportApp.mreportheader[i].font.Size;
                        text.CharacterFormat.Italic   = mReportApp.mreportheader[i].font.Italic;
                        text.CharacterFormat.Bold     = mReportApp.mreportheader[i].font.Bold;

                        DocPicture headerPicture
                            = headerParagraph.AppendPicture(Image.FromFile(System.Windows.Forms.Application.StartupPath + "\\AppleLabJ\\bmp\\" + mReportApp.mreportheader[i].filename));

                        headerPicture.HorizontalAlignment = ShapeHorizontalAlignment.Left;
                    }
                }

                if (mReportApp.mreportheader[i].kind == 1)
                {
                    string s = "";
                    s = s.PadLeft(Convert.ToInt16(mReportApp.mreportheader[i].mspace), Convert.ToChar(" "));
                    s = s + mReportApp.mreportheader[i].txtresult;
                    TextRange text = headerParagraph.AppendText(s);
                    text.CharacterFormat.FontName = mReportApp.mreportheader[i].font.Name;
                    text.CharacterFormat.FontSize = mReportApp.mreportheader[i].font.Size;
                    text.CharacterFormat.Italic   = mReportApp.mreportheader[i].font.Italic;
                    text.CharacterFormat.Bold     = mReportApp.mreportheader[i].font.Bold;
                }
            }



            for (int i = 0; i < mReportApp.mreportbody.Count; i++)
            {
                Paragraph paragraph = section.AddParagraph();

                if (mReportApp.mreportbody[i].align == 0)
                {
                    paragraph.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Left;
                }
                else if (mReportApp.mreportbody[i].align == 1)
                {
                    paragraph.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Center;
                }
                else if (mReportApp.mreportbody[i].align == 2)
                {
                    paragraph.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Right;
                }

                for (int j = 0; j < mReportApp.mreportbody[i].vspace; j++)
                {
                    paragraph.AppendBreak(BreakType.LineBreak);
                }

                if (mReportApp.mreportbody[i].kind == 0)
                {
                    string s = "";
                    s = s.PadLeft(Convert.ToInt16(mReportApp.mreportbody[i].mspace), Convert.ToChar(" "));
                    if (mReportApp.mreportbody[i].showcaption == false)
                    {
                        s = s + mReportApp.mreportbody[i].txtresult;
                    }
                    else
                    {
                        s = s + mReportApp.mreportbody[i].Name + ":" + mReportApp.mreportbody[i].txtresult;
                    }
                    TextRange text = paragraph.AppendText(s);
                    text.CharacterFormat.FontName = mReportApp.mreportbody[i].font.Name;
                    text.CharacterFormat.FontSize = mReportApp.mreportbody[i].font.Size;
                    text.CharacterFormat.Italic   = mReportApp.mreportbody[i].font.Italic;
                    text.CharacterFormat.Bold     = mReportApp.mreportbody[i].font.Bold;
                }

                if (mReportApp.mreportbody[i].kind == 3)
                {
                    string s = "";
                    s = s.PadLeft(Convert.ToInt16(mReportApp.mreportbody[i].mspace), Convert.ToChar(" "));
                    if (mReportApp.mreportbody[i].showcaption == false)
                    {
                    }
                    else
                    {
                        s = s + mReportApp.mreportbody[i].Name + ":";
                    }
                    TextRange text = paragraph.AppendText(s);
                    text.CharacterFormat.FontName = mReportApp.mreportbody[i].font.Name;
                    text.CharacterFormat.FontSize = mReportApp.mreportbody[i].font.Size;
                    text.CharacterFormat.Italic   = mReportApp.mreportbody[i].font.Italic;
                    text.CharacterFormat.Bold     = mReportApp.mreportbody[i].font.Bold;

                    if (mReportApp.mreportbody[i].Name == "曲线图1")
                    {
                        InsertImage(section, 1);
                    }

                    if (mReportApp.mreportbody[i].Name == "曲线图2")
                    {
                        InsertImage(section, 2);
                    }
                }

                if (mReportApp.mreportbody[i].kind == 4)
                {
                    string s = "";
                    s = s.PadLeft(Convert.ToInt16(mReportApp.mreportbody[i].mspace), Convert.ToChar(" "));
                    if (mReportApp.mreportbody[i].showcaption == false)
                    {
                    }
                    else
                    {
                        s = s + mReportApp.mreportbody[i].Name + ":";
                    }
                    TextRange text = paragraph.AppendText(s);
                    text.CharacterFormat.FontName = mReportApp.mreportbody[i].font.Name;
                    text.CharacterFormat.FontSize = mReportApp.mreportbody[i].font.Size;
                    text.CharacterFormat.Italic   = mReportApp.mreportbody[i].font.Italic;
                    text.CharacterFormat.Bold     = mReportApp.mreportbody[i].font.Bold;

                    if (mReportApp.mreportbody[i].Name == "结果表格1")
                    {
                        addTable(section, 1);
                    }

                    if (mReportApp.mreportbody[i].Name == "结果表格2")
                    {
                        addTable(section, 2);
                    }
                }
            }



            Paragraph footerParagraph = footer.AddParagraph();

            footerParagraph.Format.Borders.Bottom.BorderType
                = Spire.Doc.Documents.BorderStyle.Single;

            Paragraph FParagraph = footer.AddParagraph();



            for (int i = 0; i < mReportApp.mreportfooter.Count; i++)
            {
                if (mReportApp.mreportfooter[i].kind == 0)
                {
                    string s = "";
                    s = s.PadLeft(Convert.ToInt16(mReportApp.mreportfooter[i].mspace), Convert.ToChar(" "));
                    if (mReportApp.mreportfooter[i].showcaption == false)
                    {
                        s = s + mReportApp.mreportfooter[i].txtresult;
                    }
                    else
                    {
                        s = s + mReportApp.mreportfooter[i].Name + ":" + mReportApp.mreportfooter[i].txtresult;
                    }



                    TextRange text = FParagraph.AppendText(s);
                    text.CharacterFormat.FontName = mReportApp.mreportfooter[i].font.Name;
                    text.CharacterFormat.FontSize = mReportApp.mreportfooter[i].font.Size;
                    text.CharacterFormat.Italic   = mReportApp.mreportfooter[i].font.Italic;
                    text.CharacterFormat.Bold     = mReportApp.mreportfooter[i].font.Bold;
                }
                if (mReportApp.mreportfooter[i].kind == 2)
                {
                    if (mReportApp.mreportfooter[i].filename.Trim() == "")
                    {
                    }
                    else
                    {
                        string s = "";
                        s = s.PadLeft(Convert.ToInt16(mReportApp.mreportfooter[i].mspace), Convert.ToChar(" "));

                        TextRange text = footerParagraph.AppendText(s);
                        text.CharacterFormat.FontName = mReportApp.mreportfooter[i].font.Name;
                        text.CharacterFormat.FontSize = mReportApp.mreportfooter[i].font.Size;
                        text.CharacterFormat.Italic   = mReportApp.mreportfooter[i].font.Italic;
                        text.CharacterFormat.Bold     = mReportApp.mreportfooter[i].font.Bold;

                        DocPicture footerPicture
                            = FParagraph.AppendPicture(Image.FromFile(System.Windows.Forms.Application.StartupPath + "\\AppleLabJ\\bmp\\" + mReportApp.mreportfooter[i].filename));

                        footerPicture.HorizontalAlignment = ShapeHorizontalAlignment.Left;
                    }
                }

                if (mReportApp.mreportfooter[i].kind == 1)
                {
                    string s = "";
                    s = s.PadLeft(Convert.ToInt16(mReportApp.mreportfooter[i].mspace), Convert.ToChar(" "));
                    s = s + mReportApp.mreportfooter[i].txtresult;
                    TextRange text = FParagraph.AppendText(s);
                    text.CharacterFormat.FontName = mReportApp.mreportfooter[i].font.Name;
                    text.CharacterFormat.FontSize = mReportApp.mreportfooter[i].font.Size;
                    text.CharacterFormat.Italic   = mReportApp.mreportfooter[i].font.Italic;
                    text.CharacterFormat.Bold     = mReportApp.mreportfooter[i].font.Bold;
                }
            }



            FParagraph.AppendText("    ");
            FParagraph.AppendField("page number", FieldType.FieldPage);
            FParagraph.AppendText(" of ");
            FParagraph.AppendField("number of pages", FieldType.FieldNumPages);


            if (mReportApp.footerposition == 0)
            {
                FParagraph.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Left;
            }
            else if (mReportApp.footerposition == 1)
            {
                FParagraph.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Center;
            }
            else if (mReportApp.footerposition == 2)
            {
                FParagraph.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Right;
            }



            //Set Footer Paragrah Format



            FParagraph.Format.Borders.Top.BorderType = Spire.Doc.Documents.BorderStyle.Hairline;

            FParagraph.Format.Borders.Top.Space = 0.01f;


            FParagraph.Format.Borders.Color = Color.Black;



            dialog.AllowCurrentPage = true;
            dialog.AllowSomePages   = true;
            dialog.UseEXDialog      = true;



            dialog.PrinterSettings.DefaultPageSettings.Landscape = mReportApp.Landscape;



            document.PrintDialog = dialog;



            if (printed == false)
            {
                if (UserControl报告常规1 == null)
                {
                    PrintPreviewControl m1 = new PrintPreviewControl();
                    m1.Document = document.PrintDocument;
                    m1.InvalidatePreview();
                }
                else
                {
                    UserControl报告常规1.printPreviewControl1.Document = document.PrintDocument;


                    UserControl报告常规1.printPreviewControl1.InvalidatePreview();
                }
            }
            else
            {
                document.PrintDialog = dialog;


                document.PrintDocument.Print();
            }
        }
Exemplo n.º 11
0
 /// <summary>
 /// Sets the printer's document to the specified PrintPreviewControl.
 /// </summary>
 /// <param name="previewControl">The control the will be previewing the
 /// printer's document.</param>
 public void SetPrintPreview(PrintPreviewControl previewControl)
 {
     previewControl.Document = m_printDoc;
 }
Exemplo n.º 12
0
		private void InitializeComponent()
		{
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmPrintPreview));
            this.cmdMoveUp = new ToolStripButton("cmdMoveUp");
            this.cmdMoveDown = new ToolStripButton("cmdMoveDown");
            this.cmdZoom100 = new ToolStripButton("cmdZoom100");
            this.cmdOnePage = new ToolStripButton("cmdOnePage");
            this.cmdTwoPages = new ToolStripButton("cmdTwoPages");
            this.cmdPageSetup = new ToolStripButton("cmdPageSetup");
            this.cmdPrint = new ToolStripButton("cmdPrint");
            this.cmdClose = new ToolStripButton("cmdClose");
            this.cmdMoveUp1 = new ToolStripButton("cmdMoveUp");
            this.cmdMoveDown1 = new ToolStripButton("cmdMoveDown");
            this.cmdSeparator1 = new ToolStripButton("Separator");
            this.cmdZoom1001 = new ToolStripButton("cmdZoom100");
            this.cmdOnePage1 = new ToolStripButton("cmdOnePage");
            this.cmdTwoPages1 = new ToolStripButton("cmdTwoPages");
            this.cmdSeparator2 = new ToolStripButton("Separator");
            this.cmdPageSetup1 = new ToolStripButton("cmdPageSetup");
            this.cmdSeparator3 = new ToolStripButton("Separator");
            this.cmdPrint1 = new ToolStripButton("cmdPrint");
            this.cmdSeparator4 = new ToolStripButton("Separator");
            this.cmdClose1 = new ToolStripButton("cmdClose");
            this.icons = new System.Windows.Forms.ImageList(this.components);
            this.PrintPreviewControl1 = new System.Windows.Forms.PrintPreviewControl();
            this.PageSetupDialog1 = new System.Windows.Forms.PageSetupDialog();
            this.UiCommandBar1 = new ToolStrip();
            this.toolStrip1 = new System.Windows.Forms.ToolStrip();
            this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
            this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
            this.toolStrip1.SuspendLayout();
            this.SuspendLayout();
            // 
            // cmdMoveUp
            // 
            this.cmdMoveUp.ImageIndex = 0;
            this.cmdMoveUp.Name = "cmdMoveUp";
            this.cmdMoveUp.Text = "Page Up";
            this.cmdMoveUp.ToolTipText = "Page Up";
            // 
            // cmdMoveDown
            // 
            this.cmdMoveDown.ImageIndex = 1;
            this.cmdMoveDown.Name = "cmdMoveDown";
            this.cmdMoveDown.Text = "Page Down";
            this.cmdMoveDown.ToolTipText = "Page Down";
            // 
            // cmdZoom100
            // 
            this.cmdZoom100.ImageIndex = 3;
            this.cmdZoom100.Name = "cmdZoom100";
            this.cmdZoom100.Text = "Actual Size";
            this.cmdZoom100.ToolTipText = "Actual Size";
            // 
            // cmdOnePage
            // 
            this.cmdOnePage.ImageIndex = 2;
            this.cmdOnePage.Name = "cmdOnePage";
            this.cmdOnePage.Text = "One Page";
            this.cmdOnePage.ToolTipText = "One Page";
            // 
            // cmdTwoPages
            // 
            this.cmdTwoPages.ImageIndex = 4;
            this.cmdTwoPages.Name = "cmdTwoPages";
            this.cmdTwoPages.Text = "Two Pages";
            this.cmdTwoPages.ToolTipText = "Two Pages";
            // 
            // cmdPageSetup
            // 
            this.cmdPageSetup.ImageIndex = 6;
            this.cmdPageSetup.Name = "cmdPageSetup";
            this.cmdPageSetup.Text = "Page Setup...";
            this.cmdPageSetup.ToolTipText = "Page Setup";
            // 
            // cmdPrint
            // 
            this.cmdPrint.ImageIndex = 5;
            this.cmdPrint.Name = "cmdPrint";
            this.cmdPrint.Text = "Print";
            this.cmdPrint.ToolTipText = "Print";
            // 
            // cmdClose
            // 
            this.cmdClose.Name = "cmdClose";
            this.cmdClose.Text = "Close";
            this.cmdClose.ToolTipText = "Close Preview";
            // 
            // cmdMoveUp1
            // 
            this.cmdMoveUp1.Name = "cmdMoveUp1";
            // 
            // cmdMoveDown1
            // 
            this.cmdMoveDown1.Name = "cmdMoveDown1";
            // 
            // cmdSeparator1
            // 
            this.cmdSeparator1.Name = "cmdSeparator1";
            // 
            // cmdZoom1001
            // 
            this.cmdZoom1001.Name = "cmdZoom1001";
            // 
            // cmdOnePage1
            // 
            this.cmdOnePage1.Name = "cmdOnePage1";
            // 
            // cmdTwoPages1
            // 
            this.cmdTwoPages1.Name = "cmdTwoPages1";
            // 
            // cmdSeparator2
            // 
            this.cmdSeparator2.Name = "cmdSeparator2";
            // 
            // cmdPageSetup1
            // 
            this.cmdPageSetup1.Name = "cmdPageSetup1";
            // 
            // cmdSeparator3
            // 
            this.cmdSeparator3.Name = "cmdSeparator3";
            // 
            // cmdPrint1
            // 
            this.cmdPrint1.Name = "cmdPrint1";
            // 
            // cmdSeparator4
            // 
            this.cmdSeparator4.Name = "cmdSeparator4";
            // 
            // cmdClose1
            // 
            this.cmdClose1.Name = "cmdClose1";
            // 
            // icons
            // 
            this.icons.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("icons.ImageStream")));
            this.icons.TransparentColor = System.Drawing.Color.Transparent;
            this.icons.Images.SetKeyName(0, "");
            this.icons.Images.SetKeyName(1, "");
            this.icons.Images.SetKeyName(2, "");
            this.icons.Images.SetKeyName(3, "");
            this.icons.Images.SetKeyName(4, "");
            this.icons.Images.SetKeyName(5, "");
            this.icons.Images.SetKeyName(6, "");
            // 
            // PrintPreviewControl1
            // 
            this.PrintPreviewControl1.AutoZoom = false;
            this.PrintPreviewControl1.BackColor = System.Drawing.SystemColors.ControlLight;
            this.PrintPreviewControl1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.PrintPreviewControl1.Location = new System.Drawing.Point(0, 28);
            this.PrintPreviewControl1.Name = "PrintPreviewControl1";
            this.PrintPreviewControl1.Size = new System.Drawing.Size(708, 390);
            this.PrintPreviewControl1.TabIndex = 1;
            this.PrintPreviewControl1.UseAntiAlias = true;
            this.PrintPreviewControl1.Zoom = 1;
            this.PrintPreviewControl1.StartPageChanged += new System.EventHandler(this.PrintPreviewControl1_StartPageChanged);
           
            // 
            // UiCommandBar1
            // 
            this.UiCommandBar1.Items.AddRange(new ToolStripButton[] {
            this.cmdMoveUp1,
            this.cmdMoveDown1,
            this.cmdSeparator1,
            this.cmdZoom1001,
            this.cmdOnePage1,
            this.cmdTwoPages1,
            this.cmdSeparator2,
            this.cmdPageSetup1,
            this.cmdSeparator3,
            this.cmdPrint1,
            this.cmdSeparator4,
            this.cmdClose1});
            this.UiCommandBar1.Location = new System.Drawing.Point(0, 0);
            this.UiCommandBar1.Name = "UiCommandBar1";
            this.UiCommandBar1.Size = new System.Drawing.Size(333, 28);
            this.UiCommandBar1.Text = "Print Preview";           
            // 
            // toolStrip1
            // 
            this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.toolStripButton1,
            this.toolStripSeparator1});
            this.toolStrip1.Location = new System.Drawing.Point(0, 28);
            this.toolStrip1.Name = "toolStrip1";
            this.toolStrip1.Size = new System.Drawing.Size(708, 25);
            this.toolStrip1.TabIndex = 2;
            this.toolStrip1.Text = "toolStrip1";
            // 
            // toolStripButton1
            // 
            this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
            this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image")));
            this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.toolStripButton1.Name = "toolStripButton1";
            this.toolStripButton1.Size = new System.Drawing.Size(23, 22);
            this.toolStripButton1.Text = "toolStripButton1";
            // 
            // toolStripSeparator1
            // 
            this.toolStripSeparator1.Name = "toolStripSeparator1";
            this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
            // 
            // frmPrintPreview
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);
            this.ClientSize = new System.Drawing.Size(708, 418);
            this.Controls.Add(this.toolStrip1);
            this.Controls.Add(this.UiCommandBar1);
            this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name = "frmPrintPreview";
            this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
            this.Text = "frmPrintPreview";
            this.Load += new System.EventHandler(this.frmPrintPreview_Load);
            ((System.ComponentModel.ISupportInitialize)(this.UiCommandBar1)).EndInit();
            this.toolStrip1.ResumeLayout(false);
            this.toolStrip1.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

		}
Exemplo n.º 13
0
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PrintV));
     this.toolStrip1           = new System.Windows.Forms.ToolStrip();
     this.toolStripButton3     = new System.Windows.Forms.ToolStripButton();
     this.toolStripLabel1      = new System.Windows.Forms.ToolStripLabel();
     this.toolStripComboBox1   = new System.Windows.Forms.ToolStripComboBox();
     this.printPreviewControl1 = new System.Windows.Forms.PrintPreviewControl();
     this.printDocument1       = new System.Drawing.Printing.PrintDocument();
     this.toolStripButton1     = new System.Windows.Forms.ToolStripButton();
     this.toolStrip1.SuspendLayout();
     this.SuspendLayout();
     //
     // toolStrip1
     //
     this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
         this.toolStripButton3,
         this.toolStripLabel1,
         this.toolStripComboBox1,
         this.toolStripButton1
     });
     this.toolStrip1.Location = new System.Drawing.Point(0, 0);
     this.toolStrip1.Name     = "toolStrip1";
     this.toolStrip1.Size     = new System.Drawing.Size(662, 25);
     this.toolStrip1.TabIndex = 0;
     this.toolStrip1.Text     = "toolStrip1";
     //
     // toolStripButton3
     //
     this.toolStripButton3.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton3.Image")));
     this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.toolStripButton3.Name   = "toolStripButton3";
     this.toolStripButton3.Size   = new System.Drawing.Size(52, 22);
     this.toolStripButton3.Text   = "打印";
     this.toolStripButton3.Click += new System.EventHandler(this.toolStripButton3_Click);
     //
     // toolStripLabel1
     //
     this.toolStripLabel1.Name = "toolStripLabel1";
     this.toolStripLabel1.Size = new System.Drawing.Size(32, 22);
     this.toolStripLabel1.Text = "页码";
     //
     // toolStripComboBox1
     //
     this.toolStripComboBox1.Name = "toolStripComboBox1";
     this.toolStripComboBox1.Size = new System.Drawing.Size(121, 25);
     this.toolStripComboBox1.SelectedIndexChanged += new System.EventHandler(this.toolStripComboBox1_SelectedIndexChanged);
     //
     // printPreviewControl1
     //
     this.printPreviewControl1.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.printPreviewControl1.Location = new System.Drawing.Point(0, 25);
     this.printPreviewControl1.Name     = "printPreviewControl1";
     this.printPreviewControl1.Size     = new System.Drawing.Size(662, 456);
     this.printPreviewControl1.TabIndex = 1;
     //
     // printDocument1
     //
     this.printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument1_PrintPage);
     //
     // toolStripButton1
     //
     this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image")));
     this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.toolStripButton1.Name   = "toolStripButton1";
     this.toolStripButton1.Size   = new System.Drawing.Size(52, 22);
     this.toolStripButton1.Text   = "退出";
     this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click);
     //
     // PrintV
     //
     this.ClientSize = new System.Drawing.Size(662, 481);
     this.Controls.Add(this.printPreviewControl1);
     this.Controls.Add(this.toolStrip1);
     this.Name          = "PrintV";
     this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
     this.Text          = "打印预览";
     this.WindowState   = System.Windows.Forms.FormWindowState.Maximized;
     this.Load         += new System.EventHandler(this.PrintV_Load);
     this.toolStrip1.ResumeLayout(false);
     this.toolStrip1.PerformLayout();
     this.ResumeLayout(false);
     this.PerformLayout();
 }
Exemplo n.º 14
0
 public FormPrintResult(PrintPreviewControl ppc)
 {
     InitializeComponent();
     this.ppc = ppc;
 }
Exemplo n.º 15
0
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Teroid.DataGridViewToolStrip.PrintPreviewDialog));

            this.pprev               = new PrintPreviewControl();
            this.toolStrip1          = new ToolStrip();
            this.btnPrint            = new ToolStripButton();
            this.toolStripSeparator1 = new ToolStripSeparator();
            this.btnZoom             = new ToolStripDropDownButton();
            this.mnuAuto             = new ToolStripMenuItem();
            this.mnu500              = new ToolStripMenuItem();
            this.mnu200              = new ToolStripMenuItem();
            this.mnu150              = new ToolStripMenuItem();
            this.mnu100              = new ToolStripMenuItem();
            this.mnu75               = new ToolStripMenuItem();
            this.mnu50               = new ToolStripMenuItem();
            this.mnu25               = new ToolStripMenuItem();
            this.mnu10               = new ToolStripMenuItem();
            this.toolStripSeparator2 = new ToolStripSeparator();
            this.btn1x1              = new ToolStripButton();
            this.btn2x1              = new ToolStripButton();
            this.btn3x1              = new ToolStripButton();
            this.btn2x2              = new ToolStripButton();
            this.btn3x2              = new ToolStripButton();
            this.toolStripSeparator3 = new ToolStripSeparator();
            this.btnFirst            = new ToolStripButton();
            this.btnPrev             = new ToolStripButton();
            this.lblPage             = new ToolStripLabel();
            this.btnNext             = new ToolStripButton();
            this.btnLast             = new ToolStripButton();
            this.toolStrip1.SuspendLayout();
            base.SuspendLayout();
            this.pprev.Anchor         = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this.pprev.Location       = new Point(0, 0x19);
            this.pprev.Name           = "pprev";
            this.pprev.Size           = new Size(0x2ba, 0x155);
            this.pprev.TabIndex       = 0;
            this.toolStrip1.AutoSize  = false;
            this.toolStrip1.GripStyle = ToolStripGripStyle.Hidden;
            this.toolStrip1.Items.AddRange(new ToolStripItem[] { this.btnPrint, this.toolStripSeparator1, this.btnZoom, this.toolStripSeparator2, this.btn1x1, this.btn2x1, this.btn3x1, this.btn2x2, this.btn3x2, this.toolStripSeparator3, this.btnFirst, this.btnPrev, this.lblPage, this.btnNext, this.btnLast });
            this.toolStrip1.Location            = new Point(0, 0);
            this.toolStrip1.Name                = "toolStrip1";
            this.toolStrip1.Size                = new Size(0x2ba, 0x19);
            this.toolStrip1.TabIndex            = 1;
            this.toolStrip1.Text                = "toolStrip1";
            this.btnPrint.DisplayStyle          = ToolStripItemDisplayStyle.Image;
            this.btnPrint.Image                 = Resources.print;
            this.btnPrint.ImageTransparentColor = Color.Magenta;
            this.btnPrint.Name            = "btnPrint";
            this.btnPrint.Size            = new Size(0x17, 0x16);
            this.btnPrint.Text            = "&Print";
            this.btnPrint.Click          += new EventHandler(this.btnPrint_Click);
            this.toolStripSeparator1.Name = "toolStripSeparator1";
            this.toolStripSeparator1.Size = new Size(6, 0x19);
            this.btnZoom.DropDownItems.AddRange(new ToolStripItem[] { this.mnuAuto, this.mnu500, this.mnu200, this.mnu150, this.mnu100, this.mnu75, this.mnu50, this.mnu25, this.mnu10 });
            this.btnZoom.Image = Resources.zoom;
            this.btnZoom.ImageTransparentColor = Color.Magenta;
            this.btnZoom.Name                   = "btnZoom";
            this.btnZoom.Size                   = new Size(0x3b, 0x16);
            this.btnZoom.Text                   = "Auto";
            this.btnZoom.ToolTipText            = "Zoom";
            this.mnuAuto.Name                   = "mnuAuto";
            this.mnuAuto.Size                   = new Size(0x72, 0x16);
            this.mnuAuto.Text                   = "Auto";
            this.mnuAuto.Click                 += new EventHandler(this.mnuAuto_Click);
            this.mnu500.Name                    = "mnu500";
            this.mnu500.Size                    = new Size(0x72, 0x16);
            this.mnu500.Text                    = "500%";
            this.mnu500.Click                  += new EventHandler(this.mnu500_Click);
            this.mnu200.Name                    = "mnu200";
            this.mnu200.Size                    = new Size(0x72, 0x16);
            this.mnu200.Text                    = "200%";
            this.mnu200.Click                  += new EventHandler(this.mnu200_Click);
            this.mnu150.Name                    = "mnu150";
            this.mnu150.Size                    = new Size(0x72, 0x16);
            this.mnu150.Text                    = "150%";
            this.mnu150.Click                  += new EventHandler(this.mnu150_Click);
            this.mnu100.Name                    = "mnu100";
            this.mnu100.Size                    = new Size(0x72, 0x16);
            this.mnu100.Text                    = "100%";
            this.mnu100.Click                  += new EventHandler(this.mnu100_Click);
            this.mnu75.Name                     = "mnu75";
            this.mnu75.Size                     = new Size(0x72, 0x16);
            this.mnu75.Text                     = "75%";
            this.mnu75.Click                   += new EventHandler(this.mnu75_Click);
            this.mnu50.Name                     = "mnu50";
            this.mnu50.Size                     = new Size(0x72, 0x16);
            this.mnu50.Text                     = "50%";
            this.mnu50.Click                   += new EventHandler(this.mnu50_Click);
            this.mnu25.Name                     = "mnu25";
            this.mnu25.Size                     = new Size(0x72, 0x16);
            this.mnu25.Text                     = "25%";
            this.mnu25.Click                   += new EventHandler(this.mnu25_Click);
            this.mnu10.Name                     = "mnu10";
            this.mnu10.Size                     = new Size(0x72, 0x16);
            this.mnu10.Text                     = "10%";
            this.mnu10.Click                   += new EventHandler(this.mnu10_Click);
            this.toolStripSeparator2.Name       = "toolStripSeparator2";
            this.toolStripSeparator2.Size       = new Size(6, 0x19);
            this.btn1x1.DisplayStyle            = ToolStripItemDisplayStyle.Image;
            this.btn1x1.Image                   = (Image)manager.GetObject("btn1x1.Image");
            this.btn1x1.ImageTransparentColor   = Color.Magenta;
            this.btn1x1.Name                    = "btn1x1";
            this.btn1x1.Size                    = new Size(0x17, 0x16);
            this.btn1x1.Text                    = "1 page";
            this.btn1x1.ToolTipText             = "1 page";
            this.btn1x1.Click                  += new EventHandler(this.btn1x1_Click);
            this.btn2x1.DisplayStyle            = ToolStripItemDisplayStyle.Image;
            this.btn2x1.Image                   = (Image)manager.GetObject("btn2x1.Image");
            this.btn2x1.ImageTransparentColor   = Color.Magenta;
            this.btn2x1.Name                    = "btn2x1";
            this.btn2x1.Size                    = new Size(0x17, 0x16);
            this.btn2x1.Text                    = "2 pages";
            this.btn2x1.ToolTipText             = "2 pages";
            this.btn2x1.Click                  += new EventHandler(this.btn2x1_Click);
            this.btn3x1.DisplayStyle            = ToolStripItemDisplayStyle.Image;
            this.btn3x1.Image                   = Resources.pp3x1;
            this.btn3x1.ImageTransparentColor   = Color.Magenta;
            this.btn3x1.Name                    = "btn3x1";
            this.btn3x1.Size                    = new Size(0x17, 0x16);
            this.btn3x1.Text                    = "3 pages";
            this.btn3x1.ToolTipText             = "3 pages";
            this.btn3x1.Click                  += new EventHandler(this.btn3x1_Click);
            this.btn2x2.DisplayStyle            = ToolStripItemDisplayStyle.Image;
            this.btn2x2.Image                   = Resources.pp2x2;
            this.btn2x2.ImageTransparentColor   = Color.Magenta;
            this.btn2x2.Name                    = "btn2x2";
            this.btn2x2.Size                    = new Size(0x17, 0x16);
            this.btn2x2.Text                    = "4 pages";
            this.btn2x2.ToolTipText             = "4 pages";
            this.btn2x2.Click                  += new EventHandler(this.btn2x2_Click);
            this.btn3x2.DisplayStyle            = ToolStripItemDisplayStyle.Image;
            this.btn3x2.Image                   = Resources.pp3x2;
            this.btn3x2.ImageTransparentColor   = Color.Magenta;
            this.btn3x2.Name                    = "btn3x2";
            this.btn3x2.Size                    = new Size(0x17, 0x16);
            this.btn3x2.Text                    = "6 pages";
            this.btn3x2.ToolTipText             = "6 pages";
            this.btn3x2.Click                  += new EventHandler(this.btn3x2_Click);
            this.toolStripSeparator3.Name       = "toolStripSeparator3";
            this.toolStripSeparator3.Size       = new Size(6, 0x19);
            this.btnFirst.DisplayStyle          = ToolStripItemDisplayStyle.Image;
            this.btnFirst.Image                 = Resources.first;
            this.btnFirst.ImageScaling          = ToolStripItemImageScaling.None;
            this.btnFirst.ImageTransparentColor = Color.Magenta;
            this.btnFirst.Name                  = "btnFirst";
            this.btnFirst.Size                  = new Size(0x17, 0x16);
            this.btnFirst.Text                  = "First page";
            this.btnFirst.ToolTipText           = "First";
            this.btnFirst.Click                += new EventHandler(this.btnFirst_Click);
            this.btnPrev.DisplayStyle           = ToolStripItemDisplayStyle.Image;
            this.btnPrev.Image                  = Resources.previous;
            this.btnPrev.ImageTransparentColor  = Color.Magenta;
            this.btnPrev.Name                   = "btnPrev";
            this.btnPrev.Size                   = new Size(0x17, 0x16);
            this.btnPrev.Text                   = "Previous page";
            this.btnPrev.ToolTipText            = "Previous";
            this.btnPrev.Click                 += new EventHandler(this.btnPrev_Click);
            this.lblPage.BackColor              = SystemColors.Window;
            this.lblPage.DisplayStyle           = ToolStripItemDisplayStyle.Text;
            this.lblPage.Name                   = "lblPage";
            this.lblPage.Size                   = new Size(0x3e, 0x16);
            this.lblPage.Text                   = "Page 0 of 0";
            this.lblPage.ToolTipText            = "Page Number";
            this.btnNext.DisplayStyle           = ToolStripItemDisplayStyle.Image;
            this.btnNext.Image                  = Resources.next;
            this.btnNext.ImageTransparentColor  = Color.Magenta;
            this.btnNext.Name                   = "btnNext";
            this.btnNext.Size                   = new Size(0x17, 0x16);
            this.btnNext.Text                   = "Next page";
            this.btnNext.ToolTipText            = "Next";
            this.btnNext.Click                 += new EventHandler(this.btnNext_Click);
            this.btnLast.DisplayStyle           = ToolStripItemDisplayStyle.Image;
            this.btnLast.Image                  = Resources.last;
            this.btnLast.ImageTransparentColor  = Color.Magenta;
            this.btnLast.Name                   = "btnLast";
            this.btnLast.Size                   = new Size(0x17, 0x16);
            this.btnLast.Text                   = "Last page";
            this.btnLast.ToolTipText            = "Last";
            this.btnLast.Click                 += new EventHandler(this.btnLast_Click);
            base.AutoScaleDimensions            = new SizeF(6f, 13f);
            base.AutoScaleMode                  = AutoScaleMode.Font;
            base.ClientSize                     = new Size(0x2ba, 0x16e);
            base.Controls.Add(this.toolStrip1);
            base.Controls.Add(this.pprev);
            base.Name            = "PrintPreviewDialog";
            this.Text            = "Print Preview";
            base.WindowState     = FormWindowState.Maximized;
            base.VisibleChanged += new EventHandler(this.PrintPreviewDialog_VisibleChanged);
            this.toolStrip1.ResumeLayout(false);
            this.toolStrip1.PerformLayout();
            base.ResumeLayout(false);
        }
Exemplo n.º 16
0
 private void InitializeComponent()
 {
     this.pnlLeft = new BOF.CtlPanel();
     this.lstDocs = new System.Windows.Forms.ListView();
     //this.lblCount = new System.Windows.Forms.Label();
     this.lblPrinters = new System.Windows.Forms.Label();
     this.btnPrint    = new System.Windows.Forms.Button();
     this.btnClose    = new System.Windows.Forms.Button();
     this.cmbPrinters = new System.Windows.Forms.ComboBox();
     //this.txtCount = new BOF.CtlInt();
     //this.blnForAll = new BOF.CtlBool();
     //this.lnkClose = new System.Windows.Forms.LinkLabel();
     this.blnOne = new BOF.CtlBool();
     this.pnlLeft.SuspendLayout();
     //((System.ComponentModel.ISupportInitialize)(this.txtCount)).BeginInit();
     this.SuspendLayout();
     //
     // ctlPreview
     //
     this.ctlPreview           = new System.Windows.Forms.PrintPreviewControl();
     this.ctlPreview.BackColor = System.Drawing.Color.SlateGray;
     this.ctlPreview.Dock      = System.Windows.Forms.DockStyle.Fill;
     this.ctlPreview.Location  = new System.Drawing.Point(236, 0);
     this.ctlPreview.Name      = "ctlPreview";
     this.ctlPreview.AutoZoom  = false;
     this.ctlPreview.Size      = new System.Drawing.Size(377, 368);
     this.ctlPreview.TabIndex  = 0;
     this.ctlPreview.Resize   += new EventHandler(ctlPreview_Resize);
     //
     // pnlLeft
     //
     //this.pnlLeft.Controls.Add(this.lnkClose);
     this.pnlLeft.Controls.Add(this.lstDocs);
     //this.pnlLeft.Controls.Add(this.lblCount);
     this.pnlLeft.Controls.Add(this.lblPrinters);
     this.pnlLeft.Controls.Add(this.cmbPrinters);
     this.pnlLeft.Controls.Add(this.btnPrint);
     this.pnlLeft.Controls.Add(this.btnClose);
     //this.pnlLeft.Controls.Add(this.txtCount);
     //this.pnlLeft.Controls.Add(this.blnForAll);
     this.pnlLeft.Controls.Add(this.blnOne);
     this.pnlLeft.Dock = System.Windows.Forms.DockStyle.Left;
     this.pnlLeft.InactiveGradientHighColor = System.Drawing.Color.FromArgb(((int)(((byte)(210)))), ((int)(((byte)(226)))), ((int)(((byte)(237)))));
     this.pnlLeft.InactiveGradientLowColor  = System.Drawing.Color.FromArgb(((int)(((byte)(161)))), ((int)(((byte)(191)))), ((int)(((byte)(217)))));
     this.pnlLeft.Location = new System.Drawing.Point(0, 0);
     this.pnlLeft.Name     = "pnlLeft";
     this.pnlLeft.Size     = new System.Drawing.Size(236, 368);
     this.pnlLeft.TabIndex = 0;
     this.pnlLeft.Paint   += new PaintEventHandler(pnlLeft_Paint);
     //
     // lstDocs
     //
     this.lstDocs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                  | System.Windows.Forms.AnchorStyles.Left)
                                                                 | System.Windows.Forms.AnchorStyles.Right)));
     this.lstDocs.CheckBoxes    = true;
     this.lstDocs.FullRowSelect = true;
     this.lstDocs.Location      = new System.Drawing.Point(10, 23);
     this.lstDocs.MultiSelect   = false;
     this.lstDocs.Name          = "lstDocs";
     this.lstDocs.Size          = new System.Drawing.Size(220, 130);
     this.lstDocs.TabIndex      = 0;
     this.lstDocs.UseCompatibleStateImageBehavior = false;
     this.lstDocs.View = System.Windows.Forms.View.List;
     this.lstDocs.SelectedIndexChanged += new System.EventHandler(this.lstDocs_SelectedIndexChanged);
     //
     // btnPrint
     //
     this.btnPrint.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.btnPrint.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(81)))), ((int)(((byte)(101)))), ((int)(((byte)(125)))));
     this.btnPrint.Font      = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
     this.btnPrint.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
     this.btnPrint.Location  = new System.Drawing.Point(10, 160);
     this.btnPrint.Name      = "btnPrint";
     this.btnPrint.Size      = new System.Drawing.Size(220, 37);
     this.btnPrint.TabIndex  = 1;
     this.btnPrint.Text      = "Печатать отмеченные";
     this.btnPrint.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
     this.btnPrint.UseVisualStyleBackColor = false;
     this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
     ////
     //// lblCount
     ////
     //this.lblCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     //this.lblCount.AutoSize = true;
     //this.lblCount.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
     //this.lblCount.Location = new System.Drawing.Point(119, 316);
     //this.lblCount.Name = "lblCount";
     //this.lblCount.Size = new System.Drawing.Size(90, 14);
     //this.lblCount.TabIndex = 14;
     //this.lblCount.Text = "Экземпляров";
     //
     // lblPrinters
     //
     this.lblPrinters.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     this.lblPrinters.AutoSize = false;
     this.lblPrinters.Font     = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
     this.lblPrinters.Location = new System.Drawing.Point(8, 202);
     this.lblPrinters.Name     = "lblPrinters";
     this.lblPrinters.Size     = new System.Drawing.Size(220, 14);
     this.lblPrinters.TabIndex = 66;
     this.lblPrinters.Text     = "Выводить на принтер";
     //
     // cmbPrinters
     //
     this.cmbPrinters.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)
                                                                     | System.Windows.Forms.AnchorStyles.Right)));
     this.cmbPrinters.DropDownStyle     = System.Windows.Forms.ComboBoxStyle.DropDownList;
     this.cmbPrinters.FlatStyle         = System.Windows.Forms.FlatStyle.System;
     this.cmbPrinters.FormattingEnabled = true;
     this.cmbPrinters.Location          = new System.Drawing.Point(10, 218);
     this.cmbPrinters.Name     = "cmbPrinters";
     this.cmbPrinters.Size     = new System.Drawing.Size(220, 21);
     this.cmbPrinters.TabIndex = 2;
     //
     // blnOne
     //
     this.blnOne.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
                                                                | System.Windows.Forms.AnchorStyles.Right)));
     this.blnOne.DataMember    = null;
     this.blnOne.Value         = false;
     this.blnOne.Font          = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
     this.blnOne.Location      = new System.Drawing.Point(14, 247);
     this.blnOne.Name          = "blnOne";
     this.blnOne.Text          = "В одном экземпляре";
     this.blnOne.Size          = new System.Drawing.Size(160, 18);
     this.blnOne.TabIndex      = 4;
     this.blnOne.ValueChanged += new System.EventHandler(this.blnOne_ValueChanged);
     //
     // btnClose
     //
     this.btnClose.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
     this.btnClose.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(81)))), ((int)(((byte)(101)))), ((int)(((byte)(125)))));
     this.btnClose.Font      = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
     this.btnClose.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
     this.btnClose.Location  = new System.Drawing.Point(10, 324);
     this.btnClose.Name      = "btnClose";
     this.btnClose.Size      = new System.Drawing.Size(220, 37);
     this.btnClose.TabIndex  = 6;
     this.btnClose.Text      = "Закрыть форму просмотра";
     this.btnClose.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
     this.btnClose.UseVisualStyleBackColor = false;
     this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
     ////
     //// txtCount
     ////
     //this.txtCount.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
     //            | System.Windows.Forms.AnchorStyles.Right)));
     //this.txtCount.DataMember = null;
     //this.txtCount.Location = new System.Drawing.Point(118, 333);
     //this.txtCount.Maximum = 100m;
     //this.txtCount.Minimum = 0m;
     //this.txtCount.Name = "txtCount";
     //this.txtCount.Size = new System.Drawing.Size(91, 20);
     //this.txtCount.TabIndex = 3;
     //this.txtCount.Value = 3;
     ////
     //// blnForAll
     ////
     //this.blnForAll.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
     //            | System.Windows.Forms.AnchorStyles.Right)));
     //this.blnForAll.DataMember = null;
     //this.blnForAll.Location = new System.Drawing.Point(118, 353);
     //this.blnForAll.Name = "blnForAll";
     //this.blnForAll.Text = "для всех";
     //this.blnForAll.Size = new System.Drawing.Size(91, 20);
     //this.blnForAll.TabIndex = 4;
     ////
     //// lnkClose
     ////
     //this.lnkClose.ActiveLinkColor = System.Drawing.Color.Maroon;
     //this.lnkClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     //this.lnkClose.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
     //this.lnkClose.LinkColor = System.Drawing.Color.DarkBlue;
     //this.lnkClose.Location = new System.Drawing.Point(146, 1);
     //this.lnkClose.Name = "lnkClose";
     //this.lnkClose.Padding = new System.Windows.Forms.Padding(3);
     //this.lnkClose.Size = new System.Drawing.Size(63, 21);
     //this.lnkClose.TabIndex = 0;
     //this.lnkClose.TabStop = true;
     //this.lnkClose.Text = "Закрыть";
     //this.lnkClose.VisitedLinkColor = System.Drawing.Color.Navy;
     //this.lnkClose.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkClose_LinkClicked);
     //
     // Form1
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     this.ClientSize          = new System.Drawing.Size(613, 368);
     this.MinimumSize         = new System.Drawing.Size(600, 340);
     this.Controls.Add(this.pnlLeft);
     this.Controls.Add(this.ctlPreview);
     this.ctlPreview.BringToFront();
     this.StartPosition = FormStartPosition.CenterParent;
     this.Icon          = global::BOF.Properties.Resources.printer;
     this.ShowInTaskbar = false;
     //this.CancelButton = lnkClose;
     this.CancelButton = btnClose;
     this.Name         = "Preview";
     this.Text         = "Предварительный просмотр";
     this.pnlLeft.ResumeLayout(false);
     this.pnlLeft.PerformLayout();
     //((System.ComponentModel.ISupportInitialize)(this.txtCount)).EndInit();
     this.ResumeLayout(false);
 }
Exemplo n.º 17
0
        /*
         * public void CreateWinControls(Control dockWinControl)
         * {
         * dockWinControl.SuspendLayout();
         * listWinControls.Clear();
         * string type;
         * foreach (TlControl tlControl in _clmb.listTlControls)
         * {
         * Control winControl = null;
         * type = tlControl.Type;
         *
         * if (type == "GroupBox")
         * {
         *   winControl = new GroupBox();
         *   winControl.SuspendLayout();
         *
         *   ((GroupBox)winControl).ForeColor = ((TlGroupBox)tlControl).ForeColor;
         *   ((GroupBox)winControl).Text = ((TlGroupBox)tlControl).Text;
         * }
         * else if (type == "Label")
         * {
         *   winControl = new Label();
         *
         *   ((Label)winControl).ForeColor = ((TlLabel)tlControl).ForeColor;
         *   ((Label)winControl).AutoSize = ((TlLabel)tlControl).AutoSize;
         *   ((Label)winControl).Text = ((TlLabel)tlControl).Text;
         * }
         * else if (type == "ComboBox")
         * {
         *   winControl = new ComboBox();
         *
         *   ((ComboBox)winControl).DropDownStyle = (ComboBoxStyle)((TlComboBox)tlControl).DropDownStyle;
         *   ((ComboBox)winControl).Items.AddRange(((TlComboBox)tlControl).ListItems.ToArray());
         *
         * }
         * else if (type == "TextBox")
         * {
         *   winControl = new TextBox();
         * }
         * else if (type == "Button")
         * {
         *   winControl = new Button();
         *   ((Button)winControl).Text = ((TlButton)tlControl).Text;
         * }
         * else if (type == "CheckBox")
         * {
         *   winControl = new CheckBox();
         *
         *   ((CheckBox)winControl).ForeColor = ((TlCheckBox)tlControl).ForeColor;
         *   ((CheckBox)winControl).AutoSize = ((TlCheckBox)tlControl).AutoSize;
         *   ((CheckBox)winControl).Text = ((TlCheckBox)tlControl).Text;
         * }
         * else if (type == "ListBox")
         * {
         *   winControl = new ListBox();
         * }
         * else if (type == "Panel")
         * {
         *   winControl = new Panel();
         *   winControl.SuspendLayout();
         * }
         * else if (type == "DateTimePicker")
         * {
         *   winControl = new DateTimePicker();
         *
         *   ((DateTimePicker)winControl).ShowUpDown = ((TlDateTimePicker)tlControl).ShowUpDown;
         *   ((DateTimePicker)winControl).Format = (DateTimePickerFormat)((TlDateTimePicker)tlControl).Format;
         *   ((DateTimePicker)winControl).CustomFormat = ((TlDateTimePicker)tlControl).CustomFormat;
         * }
         *
         * if (winControl != null)
         * {
         *   winControl.Name = tlControl.Name;
         *   winControl.Location = new Point(tlControl.X, tlControl.Y);
         *   winControl.Size = new Size(tlControl.Width, tlControl.Height);
         *   winControl.TabIndex = tlControl.TabIndex;
         *   winControl.Visible = tlControl.Visable;
         *   winControl.Enabled = tlControl.Enable;
         *   winControl.TabStop = tlControl.TabStop;
         *   winControl.Dock = (DockStyle)tlControl.Dock;
         *
         *   foreach (TlFont tlFont in listTlFonts)
         *   {
         *       if (tlControl.FontName == tlFont.Name)
         *       {
         *           winControl.Font = new Font(tlFont.FamilyName, tlFont.EmSize, (FontStyle)tlFont.Style);
         *           break;
         *       }
         *   }
         *
         *   listWinControls.Add(winControl);
         *
         * }
         * }
         *
         * //遍历处理控件Controls.Add();
         * foreach (Control winControl in listWinControls)
         * {
         * foreach (TlControl tlControl in _clmb.listTlControls)
         * {
         *   if (winControl.Name == tlControl.Name)
         *   {
         *       foreach (Control winParentControl in listWinControls)
         *       {
         *           if (tlControl.TlParentControl == null)
         *           {
         *               if (!dockWinControl.Controls.Contains(winControl))
         *               {
         *                   dockWinControl.Controls.Add(winControl);
         *               }
         *               break;
         *           }
         *           else if (winParentControl.Name == tlControl.TlParentControl.Name)
         *           {
         *               winParentControl.Controls.Add(winControl);
         *               break;
         *           }
         *       }
         *       break;
         *   }
         * }
         * }
         *
         *
         * foreach (Control winControl in listWinControls)
         * {
         * foreach (TlControl tlControl in _clmb.listTlControls)
         * {
         *   if (winControl.Name == tlControl.Name)
         *   {
         *       if (tlControl.Type == "Panel" || tlControl.Type == "GroupBox")
         *       {
         *           winControl.ResumeLayout(true);
         *           break;
         *       }
         *   }
         * }
         * }
         * dockWinControl.ResumeLayout(false);
         * }
         */
        #endregion

        #region 第2种实现方式, 要求:listTlControlst和listWinControls一一对应,效率更高
        public void CreateWinControls(Control dockWinControl)
        {
            //dockWinControl.SuspendLayout();
            listWinControls.Clear();
            string type;

            for (int i = 0; i < _clmb.listTlControls.Count; i++)
            {
                Control winControl = null;
                type = _clmb.listTlControls[i].Type;

                if (type == "GroupBox")
                {
                    winControl = new GroupBox();
                    //winControl.SuspendLayout();

                    ((GroupBox)winControl).ForeColor = ((TlGroupBox)_clmb.listTlControls[i]).ForeColor;
                    // ((GroupBox)winControl).Text = ((TlGroupBox)_clmb.listTlControls[i]).Text;
                }
                else if (type == "Label")
                {
                    winControl = new Label();

                    ((Label)winControl).ForeColor = ((TlLabel)_clmb.listTlControls[i]).ForeColor;
                    ((Label)winControl).AutoSize  = ((TlLabel)_clmb.listTlControls[i]).AutoSize;
                    // ((Label)winControl).Text = ((TlLabel)_clmb.listTlControls[i]).Text;
                }
                else if (type == "ComboBox")
                {
                    winControl = new ComboBox();

                    ((ComboBox)winControl).DropDownStyle = (ComboBoxStyle)((TlComboBox)_clmb.listTlControls[i]).DropDownStyle;
                    ((ComboBox)winControl).Items.AddRange(((TlComboBox)_clmb.listTlControls[i]).ListItems.ToArray());

                    if (_clmb.listTlControls[i].DicEvents.ContainsKey("SelectedIndexChanged"))
                    {
                        ((ComboBox)winControl).SelectedIndexChanged += new EventHandler(controlEvent_SelectedIndexChanged);
                    }
                }
                else if (type == "TextBox")
                {
                    winControl = new TextBox();
                }
                else if (type == "Button")
                {
                    winControl = new Button();
                }
                else if (type == "ButtonX")
                {
                    winControl = new DevComponents.DotNetBar.ButtonX();

                    if (((TlButtonX)_clmb.listTlControls[i]).Image != "")
                    {
                        ((DevComponents.DotNetBar.ButtonX)winControl).Image = (System.Drawing.Bitmap)(global::TempertureEditor.Properties.Resources.ResourceManager.GetObject(((TlButtonX)_clmb.listTlControls[i]).Image, global::TempertureEditor.Properties.Resources.Culture));
                    }

                    ((DevComponents.DotNetBar.ButtonX)winControl).AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
                    ((DevComponents.DotNetBar.ButtonX)winControl).ColorTable     = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
                }
                else if (type == "PrintPreviewControl")
                {
                    winControl = new PrintPreviewControl();

                    ((PrintPreviewControl)winControl).UseAntiAlias = true;
                    ((PrintPreviewControl)winControl).AutoZoom     = false;
                    ((PrintPreviewControl)winControl).Zoom         = 1D;
                }
                else if (type == "CheckBox")
                {
                    winControl = new CheckBox();

                    ((CheckBox)winControl).ForeColor = ((TlCheckBox)_clmb.listTlControls[i]).ForeColor;
                    ((CheckBox)winControl).AutoSize  = ((TlCheckBox)_clmb.listTlControls[i]).AutoSize;
                    ((CheckBox)winControl).Text      = ((TlCheckBox)_clmb.listTlControls[i]).Text;
                    ((CheckBox)winControl).Checked   = ((TlCheckBox)_clmb.listTlControls[i]).Checked;

                    ((CheckBox)winControl).CheckedChanged    += new EventHandler(controlEvent_CheckedChanged);
                    ((CheckBox)winControl).CheckStateChanged += new EventHandler(controlEvent_CheckStateChanged);
                }
                else if (type == "RadioButton")
                {
                    winControl = new RadioButton();

                    ((RadioButton)winControl).ForeColor = ((TlRadioButton)_clmb.listTlControls[i]).ForeColor;
                    ((RadioButton)winControl).AutoSize  = ((TlRadioButton)_clmb.listTlControls[i]).AutoSize;
                    // ((RadioButton)winControl).Text = ((TlRadioButton)_clmb.listTlControls[i]).Text;
                    ((RadioButton)winControl).UseVisualStyleBackColor = ((TlRadioButton)_clmb.listTlControls[i]).UseVisualStyleBackColor;
                    ((RadioButton)winControl).Checked = ((TlRadioButton)_clmb.listTlControls[i]).Checked;

                    ((RadioButton)winControl).CheckedChanged += new EventHandler(controlEvent_CheckedChanged);
                }
                else if (type == "ListBox")
                {
                    winControl = new ListBox();
                }
                else if (type == "Panel" || type == "PanelControl" || type == "GroupPanel")
                {
                    if (type == "Panel")
                    {
                        winControl = new Panel();
                    }
                    else
                    {
                        if (type == "PanelControl")
                        {
                            winControl = new PanelControl();
                        }
                        else
                        {
                            if (type == "GroupPanel")
                            {
                                winControl = new GroupPanel();
                            }
                            else
                            {
                            }
                        }
                        #region 未实现配置样式
                        ((PanelControl)winControl).Style.BackColor2SchemePart   = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2;
                        ((PanelControl)winControl).Style.BackColorGradientAngle = 90;
                        ((PanelControl)winControl).Style.BackColorSchemePart    = DevComponents.DotNetBar.eColorSchemePart.PanelBackground;
                        ((PanelControl)winControl).Style.BorderBottom           = DevComponents.DotNetBar.eStyleBorderType.Solid;
                        ((PanelControl)winControl).Style.BorderBottomWidth      = 1;
                        ((PanelControl)winControl).Style.BorderColorSchemePart  = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
                        ((PanelControl)winControl).Style.BorderLeft             = DevComponents.DotNetBar.eStyleBorderType.Solid;
                        ((PanelControl)winControl).Style.BorderLeftWidth        = 1;
                        ((PanelControl)winControl).Style.BorderRight            = DevComponents.DotNetBar.eStyleBorderType.Solid;
                        ((PanelControl)winControl).Style.BorderRightWidth       = 1;
                        ((PanelControl)winControl).Style.BorderTop           = DevComponents.DotNetBar.eStyleBorderType.Solid;
                        ((PanelControl)winControl).Style.BorderTopWidth      = 1;
                        ((PanelControl)winControl).Style.CornerDiameter      = 4;
                        ((PanelControl)winControl).Style.CornerType          = DevComponents.DotNetBar.eCornerType.Rounded;
                        ((PanelControl)winControl).Style.TextAlignment       = DevComponents.DotNetBar.eStyleTextAlignment.Center;
                        ((PanelControl)winControl).Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
                        ((PanelControl)winControl).Style.TextLineAlignment   = DevComponents.DotNetBar.eStyleTextAlignment.Near;
                        ((PanelControl)winControl).StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square;
                        ((PanelControl)winControl).StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;
                        #endregion

                        ((PanelControl)winControl).ShowFocusRectangle = ((TlPanelControl)_clmb.listTlControls[i]).ShowFocusRectangle;
                        ((PanelControl)winControl).ColorSchemeStyle   = (eDotNetBarStyle)((TlPanelControl)_clmb.listTlControls[i]).ColorSchemeStyle;
                        ((PanelControl)winControl).CanvasColor        = ((TlPanelControl)_clmb.listTlControls[i]).CanvasColor;
                    }
                    ((Panel)winControl).AutoScroll = ((TlPanel)_clmb.listTlControls[i]).AutoScroll;
                }
                else if (type == "DateTimePicker")
                {
                    winControl = new DateTimePicker();

                    ((DateTimePicker)winControl).ShowUpDown   = ((TlDateTimePicker)_clmb.listTlControls[i]).ShowUpDown;
                    ((DateTimePicker)winControl).Format       = (DateTimePickerFormat)((TlDateTimePicker)_clmb.listTlControls[i]).Format;
                    ((DateTimePicker)winControl).CustomFormat = ((TlDateTimePicker)_clmb.listTlControls[i]).CustomFormat;

                    if (_clmb.listTlControls[i].DicEvents.ContainsKey("ValueChanged"))
                    {
                        ((DateTimePicker)winControl).ValueChanged += new EventHandler(controlEvent_ValueChanged);
                    }
                }
                else if (type == "PictureBox")
                {
                    winControl = new PictureBox();
                    ((PictureBox)winControl).BackColor = ((TlPictureBox)_clmb.listTlControls[i]).BackColor;
                }
                else if (type == "ExpandableSplitter")
                {
                    winControl = new DevComponents.DotNetBar.ExpandableSplitter();
                    ((DevComponents.DotNetBar.ExpandableSplitter)winControl).Style = (DevComponents.DotNetBar.eSplitterStyle)((TlExpandableSplitter)_clmb.listTlControls[i]).Style;
                }
                else if (type == "AdvTree")
                {
                    winControl = new DevComponents.AdvTree.AdvTree();
                    ((DevComponents.AdvTree.AdvTree)winControl).ForeColor = ((TlAdvTree)_clmb.listTlControls[i]).ForeColor;
                    ((DevComponents.AdvTree.AdvTree)winControl).AllowDrop = ((TlAdvTree)_clmb.listTlControls[i]).AllowDrop;

                    ((DevComponents.AdvTree.AdvTree)winControl).AccessibleRole             = System.Windows.Forms.AccessibleRole.Outline;
                    ((DevComponents.AdvTree.AdvTree)winControl).BackgroundStyle.Class      = "TreeBorderKey";
                    ((DevComponents.AdvTree.AdvTree)winControl).BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
                    ((DevComponents.AdvTree.AdvTree)winControl).NodeSpacing   = 2;
                    ((DevComponents.AdvTree.AdvTree)winControl).PathSeparator = ";";
                }
                else if (type == "Slider")
                {
                    winControl = new DevComponents.DotNetBar.Controls.Slider();
                    ((DevComponents.DotNetBar.Controls.Slider)winControl).Minimum = ((TlSlider)_clmb.listTlControls[i]).Minimum;
                    ((DevComponents.DotNetBar.Controls.Slider)winControl).Maximum = ((TlSlider)_clmb.listTlControls[i]).Maximum;
                    ((DevComponents.DotNetBar.Controls.Slider)winControl).Value   = ((TlSlider)_clmb.listTlControls[i]).Value;

                    ((DevComponents.DotNetBar.Controls.Slider)winControl).BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
                    ((DevComponents.DotNetBar.Controls.Slider)winControl).Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
                }
                else if (type == "ucAiTemperature")
                {
                    winControl = new ucAiTemperature(((TlAiTemperature)_clmb.listTlControls[i]).ClmbFileName);
                }

                /*
                 * else if (type == "ucTemperatureFrame")
                 * {
                 *  winControl = new ucTemperatureFrame(((TlAiTemperature)_clmb.listTlControls[i]).ClmbFileName);
                 * }
                 */
                else if (type == "ucTemperatureReport")
                {
                    winControl = new ucTemperatureReport(((TlTemperatureReport)_clmb.listTlControls[i]).TmbFileName);
                }
                else if (type == "RibbonBar")
                {
                    winControl = new RibbonBar();
                    ((RibbonBar)winControl).Style               = (eDotNetBarStyle)((TlRibbonBar)_clmb.listTlControls[i]).Style;
                    ((RibbonBar)winControl).TitleVisible        = ((TlRibbonBar)_clmb.listTlControls[i]).TitleVisible;
                    ((RibbonBar)winControl).AutoOverflowEnabled = ((TlRibbonBar)_clmb.listTlControls[i]).AutoOverflowEnabled;
                    ((RibbonBar)winControl).ContainerControlProcessDialogKey = ((TlRibbonBar)_clmb.listTlControls[i]).ContainerControlProcessDialogKey;
                }

                if (winControl != null)
                {
                    if (_clmb.listTlControls[i].BackColor != null)
                    {
                        winControl.BackColor = (Color)_clmb.listTlControls[i].BackColor;
                    }
                    winControl.Name     = _clmb.listTlControls[i].Name;
                    winControl.Location = new Point(_clmb.listTlControls[i].X, _clmb.listTlControls[i].Y);
                    winControl.Size     = new Size(_clmb.listTlControls[i].Width, _clmb.listTlControls[i].Height);
                    winControl.TabIndex = _clmb.listTlControls[i].TabIndex;
                    winControl.Visible  = _clmb.listTlControls[i].Visable;
                    winControl.Enabled  = _clmb.listTlControls[i].Enable;
                    winControl.TabStop  = _clmb.listTlControls[i].TabStop;
                    foreach (TlFont tlFont in _clmb.listTlFonts)
                    {
                        if (_clmb.listTlControls[i].FontName == tlFont.Name)
                        {
                            winControl.Font = new Font(tlFont.FamilyName, tlFont.EmSize, (FontStyle)tlFont.Style);
                            break;
                        }
                    }
                    winControl.Dock = (DockStyle)_clmb.listTlControls[i].Dock;
                    winControl.Text = _clmb.listTlControls[i].Text;

                    // 注: 不能使用if/else,因为同个控件可能要处理多个事件
                    if (_clmb.listTlControls[i].DicEvents.ContainsKey("Click"))
                    {
                        winControl.Click += new EventHandler(controlEvent_Click);
                    }

                    if (_clmb.listTlControls[i].DicEvents.ContainsKey("TextChanged"))
                    {
                        winControl.TextChanged += new EventHandler(controlEvent_TextChanged);
                    }

                    if (_clmb.listTlControls[i].DicEvents.ContainsKey("SizeChanged"))
                    {
                        winControl.SizeChanged += new EventHandler(controlEvent_SizeChanged);
                    }


                    listWinControls.Add(winControl);
                }
            }

            //特殊类型处理,需在所有控件创建后处理
            for (int i = 0; i < _clmb.listTlControls.Count; i++)
            {
                if (_clmb.listTlControls[i].Type == "ExpandableSplitter")
                {
                    ((DevComponents.DotNetBar.ExpandableSplitter)listWinControls[i]).ExpandableControl = listWinControls.Find(cl => cl.Name == ((TlExpandableSplitter)_clmb.listTlControls[i]).ExpandableControl); //等同以下注释代码功能

                    /*
                     * foreach (Control tmpControl in listWinControls)
                     * {
                     *  if (tmpControl.Name == ((TlExpandableSplitter)_clmb.listTlControls[i]).ExpandableControl)
                     *  {
                     *      ((DevComponents.DotNetBar.ExpandableSplitter)listWinControls[i]).ExpandableControl = tmpControl;
                     *      break;
                     *  }
                     * }
                     */
                }

                /*
                 * if (_clmb.listTlControls[i].Type == "RibbonBar")
                 * {
                 *  foreach (string itemName in ((TlRibbonBar)_clmb.listTlControls[i]).ListItems)
                 *  {
                 *      Control findControl = listWinControls.Find(cl => cl.Name == itemName);
                 *      if (findControl != null)
                 *      {
                 *        //  ((RibbonBar)listWinControls[i]).Items.Add((BaseItem)findControl);
                 *
                 *
                 *       }
                 *  }
                 * }
                 */
            }
            //遍历处理控件Controls.Add(); 当同一DockStyle时,如都为DockStyle.Top时,倒序Add才能按配置文件的正序展示
            for (int i = listWinControls.Count - 1; i >= 0; i--)
            {
                Control winControl = listWinControls[i];

                if (_clmb.listTlControls[i].TlParentControl == null)
                {
                    if (!dockWinControl.Controls.Contains(winControl))
                    {
                        dockWinControl.Controls.Add(winControl);
                    }
                }
                else
                {
                    foreach (Control winParentControl in listWinControls)
                    {
                        if (winParentControl.Name == _clmb.listTlControls[i].TlParentControl.Name)
                        {
                            winParentControl.Controls.Add(winControl);
                            break;
                        }
                    }
                }
            }

            /*
             * for (int i = listWinControls.Count - 1; i >= 0 ; i--)
             * {
             *  Control winControl = listWinControls[i];
             *  if (_clmb.listTlControls[i].Type == "Panel" || _clmb.listTlControls[i].Type == "GroupBox")
             *  {
             *      winControl.ResumeLayout(true);
             *      break;
             *  }
             * }
             */
            //dockWinControl.ResumeLayout(false);
        }