Ejemplo n.º 1
0
        private void InitializeComponent()
        {
            this.printDialog1   = new System.Windows.Forms.PrintDialog();
            this.printDocument1 = new System.Drawing.Printing.PrintDocument();
            this.SuspendLayout();
            //
            // printDialog1
            //
            this.printDialog1.Document    = this.printDocument1;
            this.printDialog1.UseEXDialog = true;
            //
            // printDocument1
            //
            this.printDocument1.PrintPage  += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument1_PrintPage);
            this.printDocument1.BeginPrint += new System.Drawing.Printing.PrintEventHandler(this.printDocument1_BeginPrint);
            this.ResumeLayout(false);

            richTextBoxPrintCtrl1 = new VaultRTFEditor();
        }
Ejemplo n.º 2
0
        private void AddDocViewer(byte[] docStream)
        {
            DocType fileDocType = GetDocumentType(docStream);

            switch (fileDocType)
            {
                case DocType.TIF:
                    {
                        try
                        {
                            TifEditor editor = new TifEditor();
                            editor.Dock = System.Windows.Forms.DockStyle.Fill;
                            editor.Edit = false;
                            editor.ExitDelegate = null;
                            editor.ImageFileName = null;
                            editor.Location = new System.Drawing.Point(0, 0);
                            editor.SaveAsFileName = null;
                            editor.ScaleFactor = 1;
                            editor.Size = new System.Drawing.Size(1148, 422);
                            editor.TabIndex = 0;
                            editor.TransDelegate = null;
                            editor.UserName = null;
                            editor.LoadImage(new MemoryStream(docStream));
                            this.Controls.Add(editor);
                        }
                        catch (Exception ex)
                        {
                            XtraMessageBox.Show("An error occurred while loading file: " + fileName + "." + Environment.NewLine +
                                "Error CNF-547 in " + PROJ_FILE_NAME + ".AddDocViewer(): " + ex.Message,
                                 "Inbound Tab Page", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        break;
                    }
                case DocType.HTML:
                    {
                        WebBrowser webBrowser = new WebBrowser();
                        webBrowser.Dock = System.Windows.Forms.DockStyle.Fill;
                        webBrowser.TabIndex = 0;
                        this.Controls.Add(webBrowser);
                        StringBuilder contents = new StringBuilder();
                        char[] str = new char[docStream.Length];
                        for (int i = 0; i < docStream.Length; i++)
                        {
                            str[i] = (char)docStream[i];
                        }
                        contents.Append(str);

                        webBrowser.Navigate("about:blank");

                        webBrowser.Document.Write(contents.ToString());
                        webBrowser.Refresh();

                        break;
                    }
                case DocType.RTF:
                    {
                        
                        VaultRTFEditor richTextBox = new VaultRTFEditor();
                        richTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
                        richTextBox.LoadFile(new MemoryStream(docStream), RichTextBoxStreamType.RichText);
                        this.Controls.Add(richTextBox);
                        break;
                    }
            }
        }
Ejemplo n.º 3
0
        private void InitializeComponent()
        {
            this.printDialog1 = new System.Windows.Forms.PrintDialog();
            this.printDocument1 = new System.Drawing.Printing.PrintDocument();
            this.SuspendLayout();
            // 
            // printDialog1
            // 
            this.printDialog1.Document = this.printDocument1;
            this.printDialog1.UseEXDialog = true;
            // 
            // printDocument1
            // 
            this.printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument1_PrintPage);
            this.printDocument1.BeginPrint += new System.Drawing.Printing.PrintEventHandler(this.printDocument1_BeginPrint);
            this.ResumeLayout(false);

            richTextBoxPrintCtrl1 = new VaultRTFEditor();
        }
Ejemplo n.º 4
0
        private void AddDocViewer(byte[] docStream)
        {
            DocType fileDocType = GetDocumentType(docStream);

            switch (fileDocType)
            {
            case DocType.TIF:
            {
                try
                {
                    TifEditor editor = new TifEditor();
                    editor.Dock           = System.Windows.Forms.DockStyle.Fill;
                    editor.Edit           = false;
                    editor.ExitDelegate   = null;
                    editor.ImageFileName  = null;
                    editor.Location       = new System.Drawing.Point(0, 0);
                    editor.SaveAsFileName = null;
                    editor.ScaleFactor    = 1;
                    editor.Size           = new System.Drawing.Size(1148, 422);
                    editor.TabIndex       = 0;
                    editor.TransDelegate  = null;
                    editor.UserName       = null;
                    editor.LoadImage(new MemoryStream(docStream));
                    this.Controls.Add(editor);
                }
                catch (Exception ex)
                {
                    XtraMessageBox.Show("An error occurred while loading file: " + fileName + "." + Environment.NewLine +
                                        "Error CNF-547 in " + PROJ_FILE_NAME + ".AddDocViewer(): " + ex.Message,
                                        "Inbound Tab Page", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                break;
            }

            case DocType.HTML:
            {
                WebBrowser webBrowser = new WebBrowser();
                webBrowser.Dock     = System.Windows.Forms.DockStyle.Fill;
                webBrowser.TabIndex = 0;
                this.Controls.Add(webBrowser);
                StringBuilder contents = new StringBuilder();
                char[]        str      = new char[docStream.Length];
                for (int i = 0; i < docStream.Length; i++)
                {
                    str[i] = (char)docStream[i];
                }
                contents.Append(str);

                webBrowser.Navigate("about:blank");

                webBrowser.Document.Write(contents.ToString());
                webBrowser.Refresh();

                break;
            }

            case DocType.RTF:
            {
                VaultRTFEditor richTextBox = new VaultRTFEditor();
                richTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
                richTextBox.LoadFile(new MemoryStream(docStream), RichTextBoxStreamType.RichText);
                this.Controls.Add(richTextBox);
                break;
            }
            }
        }