コード例 #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     c1PrintPreviewControl1.PreviewPane.HideMarginsState = HideMarginsFlags.None;
     C1.C1Preview.C1PrintDocument d = makeDoc1();
     //d.Generate();
     //d.ViewDoc();
     c1PrintPreviewControl1.Document = d;
 }
コード例 #2
0
        static public C1PrintDocument WideTable()
        {
            C1.C1Preview.C1PrintDocument doc = new C1.C1Preview.C1PrintDocument();

            RenderText rtxt = new RenderText();

            rtxt.Text = "This test demonstrates horizontal (extended) pages, which allow to " +
                        "render for example tables with many columns on separate pages that can " +
                        "be \"glued\" side to side.\n\n";
            doc.Body.Children.Add(rtxt);

            doc.Style.Font = new Font("Arial", 12, FontStyle.Regular);

            const int ROWS = 63;
            const int COLS = 16;

            RenderTable rt = new RenderTable();

            rt.Width             = "16in";
            rt.SplitHorzBehavior = SplitBehaviorEnum.SplitIfNeeded;
            for (int row = 0; row < ROWS; ++row)
            {
                for (int col = 0; col < COLS; ++col)
                {
                    RenderText celltext = new RenderText();
                    celltext.Text = string.Format("Cell ({0},{1})", row, col);
                    rt.Cells[row, col].RenderObject = celltext;
                }
            }

            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < 10; i++)
            {
                sb.Append(string.Format("Text fragment{0}", i));
            }
            rt.Cells[1, 1].Text = sb.ToString();
            // add the table to the document
            doc.Body.Children.Add(rt);

            // set up table style
            rt.Style.GridLines.All  = new LineDef("2pt", Colors.Black);
            rt.Style.GridLines.Horz = new LineDef("1pt", Colors.Gray);
            rt.Style.GridLines.Vert = new LineDef("1pt", Colors.Gray);

#if skip_this // does not work in WPF viewer yet
            // add some comments at the bottom
            rtxt      = new RenderText();
            rtxt.Text = "\n\nNote also that the preview supports such documents by showing " +
                        "the pages side by side rather than one below the other (this can be turned off " +
                        "if desired). Also, the vertical margins can be hidden in the preview for better viewing.";
            doc.Body.Children.Add(rtxt);
#endif

            return(doc);
        }
コード例 #3
0
        private C1.C1Preview.C1PrintDocument makeDoc_TableStyles()
        {
            C1.C1Preview.C1PrintDocument doc = new C1.C1Preview.C1PrintDocument();

            RenderText rtxt = new RenderText(doc);

            rtxt.Text = "This test demonstrates multiple inheritance of styles in tables. " +
                        "In the table below, the font is redefined for row 4. " +
                        "Then, the text color is redefined for column 1. " +
                        "Finally, a cell group is defined containing cells in rows 4 to 6, cols 1 & 2, " +
                        "and background color is redefined for that cell group. " +
                        "\nThe cell at the intersection of row 4 and col 1 combines all 3 styles.\n\n";
            doc.Body.Children.Add(rtxt);

            doc.Style.Font = new Font("Arial", 12, FontStyle.Regular);

            const int ROWS = 12;
            const int COLS = 6;

            RenderTable rt = new RenderTable(doc);

            rt.Style.Padding.All = new Unit("4mm");
            for (int row = 0; row < ROWS; ++row)
            {
                for (int col = 0; col < COLS; ++col)
                {
                    RenderText celltext = new RenderText(doc);
                    celltext.Text = string.Format("Cell ({0},{1})", row, col);
                    rt.Cells[row, col].RenderObject = celltext;
                }
            }
            // add the table to the document
            doc.Body.Children.Add(rt);

            // set up table style
            rt.Style.GridLines.All  = new LineDef("2pt", Color.Black);
            rt.Style.GridLines.Horz = new LineDef("1pt", Color.Gray);
            rt.Style.GridLines.Vert = new LineDef("1pt", Color.Gray);

            // define a row style
            rt.Rows[4].Style.Font = new Font("Arial", 12, FontStyle.Bold | FontStyle.Italic);

            // define a column style
            rt.Cols[1].Style.TextColor = Color.DarkOrange;

            // define a cell group with a background color
            rt.UserCellGroups.Add(new UserCellGroup(new Rectangle(1, 4, 2, 3)));
            rt.UserCellGroups[0].Style.BackColor = Color.PaleGreen;


            return(doc);
        }
コード例 #4
0
        private void button5_Click(object sender, EventArgs e)
        {
            QueryCount qc = new QueryCount();

            if (qc.ShowDialog() == DialogResult.OK)
            {
                c1PrintPreviewControl1.PreviewPane.HideMarginsState = HideMarginsFlags.None;

                C1.C1Preview.C1PrintDocument doc = makeDoc_LargeTable((int)qc.nRows.Value, (int)qc.nCols.Value);
                doc.LongOperation += new LongOperationEventHandler(doc_LongOperation);
                // _progress
                _progress.Show();
                doc_LongOperation(this, new LongOperationEventArgs(0));
                doc.Generate();
                _progress.Hide();
                doc.LongOperation -= new LongOperationEventHandler(doc_LongOperation);
                c1PrintPreviewControl1.Document = doc;
            }
        }
コード例 #5
0
        private C1.C1Preview.C1PrintDocument makeDoc_LargeTable(int nrows, int ncols)
        {
            C1.C1Preview.C1PrintDocument doc = new C1.C1Preview.C1PrintDocument();

            RenderText rtxt = new RenderText(doc);

            rtxt.Text = "This test demonstrates the speed of large tables " +
                        "(the worst bottleneck in the old print doc)." +
                        "\n\n";
            doc.Body.Children.Add(rtxt);

            doc.Style.Font = new Font("Arial", 12, FontStyle.Regular);

            int ROWS = nrows;
            int COLS = ncols;

            RenderTable rt = new RenderTable(doc);

            // allocate 3cm per column:
            rt.Width             = new Unit(ncols * 30, UnitTypeEnum.Mm);
            rt.SplitHorzBehavior = SplitBehaviorEnum.SplitIfNeeded;
            for (int row = 0; row < ROWS; ++row)
            {
                for (int col = 0; col < COLS; ++col)
                {
                    RenderText celltext = new RenderText(doc);
                    celltext.Text = string.Format("Cell ({0},{1})", row, col);
                    rt.Cells[row, col].RenderObject = celltext;
                }
            }
            // add the table to the document
            doc.Body.Children.Add(rt);

            // set up table style
            rt.Style.GridLines.All  = new LineDef("2pt", Color.Black);
            rt.Style.GridLines.Horz = new LineDef("1pt", Color.Gray);
            rt.Style.GridLines.Vert = new LineDef("1pt", Color.Gray);

            return(doc);
        }
コード例 #6
0
        static public C1PrintDocument BasicTable()
        {
            C1.C1Preview.C1PrintDocument doc = new C1.C1Preview.C1PrintDocument();

            RenderText rtxt1 = new RenderText(doc);

            rtxt1.Text = "This test shows the basic features of tables in C1PrintDocument:\n"
                         + "\t- table borders (the GridLines style property, which allows to specify 4 outer and 2 inner lines);\n"
                         + "\t- borders around individual cells and groups of cells;\n"
                         + "\t- style attributes (including borders) for groups of disconnected cells;\n"
                         + "\t- cells spanning rows and columns;\n"
                         + "\t- content alignment within the cells (spanned or otherwise);\n"
                         + "\t- table headers and footers;\n"
                         + "\t- tags (such as page number/total page count) anywhere in the document (see the table footer);\n"
                         + "\t- different style attributes including borders, font and background images.\n"
                         + "\t  \n"
            ;
            rtxt1.Style.Font           = new Font(rtxt1.Style.Font.FontFamily, 14);
            rtxt1.Style.Padding.Bottom = new Unit("5mm");
            doc.Body.Children.Add(rtxt1);

            //
            // make a table and fill all its cells with some demo data
            RenderTable rt1  = new RenderTable(doc);
            const int   ROWS = 100;
            const int   COLS = 4;

            for (int row = 0; row < ROWS; ++row)
            {
                for (int col = 0; col < COLS; ++col)
                {
                    RenderText celltext = new RenderText(doc);
                    celltext.Text = string.Format("Cell ({0},{1})", row, col);
                    // Note that rt1.Cells[row, col] will create cells on demand -
                    // no need to specify the number of rows/cols initially.
                    rt1.Cells[row, col].RenderObject = celltext;
                }
            }
            // add the table to the document
            doc.Body.Children.Add(rt1);

            //
            // unlike the old print-doc, in the new one changes can be made at any
            // point in the program, and they will be reflected in the document when
            // it is rendered. Add some customizations to the table:

            //
            // by default, tables have no borders. add a simple border:
            rt1.Style.GridLines.All  = new LineDef("2pt", Colors.DarkGray);
            rt1.Style.GridLines.Horz = new LineDef("1pt", Colors.Blue);
            rt1.Style.GridLines.Vert = new LineDef("1pt", Colors.Brown);

            //
            // table headers and footers

            // add a table header:
            // setup the header as a whole
            rt1.RowGroups[0, 2].PageHeader = true;
            System.Drawing.Image background = System.Drawing.Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("DemoTables.orange.jpg"));
            rt1.RowGroups[0, 2].Style.BackgroundImage = background;
            rt1.RowGroups[0, 2].Style.BackgroundImageAlign.StretchHorz     = true;
            rt1.RowGroups[0, 2].Style.BackgroundImageAlign.StretchVert     = true;
            rt1.RowGroups[0, 2].Style.BackgroundImageAlign.KeepAspectRatio = false;
            // multiple inheritance supported in styles: the text color from the
            // group's style will merge with the font from the cell's own style:
            rt1.RowGroups[0, 2].Style.TextColor      = Colors.LightGreen;
            rt1.RowGroups[0, 2].Style.GridLines.All  = new LineDef("2pt", Colors.DarkCyan);
            rt1.RowGroups[0, 2].Style.GridLines.Horz = LineDef.Empty;
            rt1.RowGroups[0, 2].Style.GridLines.Vert = LineDef.Empty;
            // setup specific cells in the header:
            ((RenderText)rt1.Cells[0, 0].RenderObject).Text = "Header row 0";
            ((RenderText)rt1.Cells[1, 0].RenderObject).Text = "Header row 1";
            rt1.Cells[0, 1].SpanCols     = 2;
            rt1.Cells[0, 1].SpanRows     = 2;
            rt1.Cells[0, 1].RenderObject = new RenderText(doc);
            ((RenderText)rt1.Cells[0, 1].RenderObject).Text = "Multi-row table headers and footers are supported";
            rt1.Cells[0, 1].Style.TextAlignHorz             = AlignHorzEnum.Center;
            rt1.Cells[0, 1].Style.Font = new Font("Arial", 14, FontStyle.Bold);

            // setup a table footer
            rt1.RowGroups[rt1.Rows.Count - 2, 2].PageFooter                  = true;
            rt1.RowGroups[rt1.Rows.Count - 2, 2].Style.BackColor             = Colors.LemonChiffon;
            rt1.Cells[rt1.Rows.Count - 2, 0].SpanRows                        = 2;
            rt1.Cells[rt1.Rows.Count - 2, 0].SpanCols                        = rt1.Cols.Count - 1;
            rt1.Cells[rt1.Rows.Count - 2, 0].Style.TextAlignHorz             = AlignHorzEnum.Center;
            rt1.Cells[rt1.Rows.Count - 2, 0].Style.TextAlignVert             = AlignVertEnum.Center;
            ((RenderText)rt1.Cells[rt1.Rows.Count - 2, 0].RenderObject).Text = "This is a table footer.";
            rt1.Cells[rt1.Rows.Count - 2, 3].SpanRows                        = 2;
            rt1.Cells[rt1.Rows.Count - 2, 3].Style.TextAlignHorz             = AlignHorzEnum.Right;
            // tags (such as page no/page count) can be inserted anywhere in the document
            ((RenderText)rt1.Cells[rt1.Rows.Count - 2, 3].RenderObject).Text = "Page [PageNo] of [PageCount]";

            //
            // in tables, Style.Borders merges seamlessly into the table grid lines:

            // it is easy to put a border around specific cells:
            rt1.Cells[8, 3].Style.Borders.All = new LineDef("3pt", Colors.OrangeRed);
            ((RenderText)rt1.Cells[8, 3].RenderObject).Text =
                "It is easy to put a border around a single cell using cell.Style.Borders";

            //
            // cells can be combined into groups, and their styles can be manipulated as
            // a single entity:

            // define a group of cells by specifying the rectangles bounding the cells:
            ((RenderText)rt1.Cells[3, 2].RenderObject).Text =
                "Cells can be combined into groups to be manipulated as a single entity " +
                "(such as all cells with the pale green background in this table).";
            rt1.Cells[3, 2].SpanCols = 2;
            rt1.Cells[3, 2].SpanRows = 3;
            Rectangle[] cells1 = new Rectangle[] {
                new Rectangle(2, 3, 2, 3),
                new Rectangle(0, 10, 3, 2),
                new Rectangle(1, 23, 2, 4),
                new Rectangle(1, 36, 1, 24),
                new Rectangle(0, 72, 3, 6),
            };
            UserCellGroup grp1 = new UserCellGroup(cells1);

            grp1.Style.BackColor   = Colors.PaleGreen;
            grp1.Style.Font        = new Font("Arial", 12, FontStyle.Bold);
            grp1.Style.Borders.All = new LineDef("2pt", Colors.DarkGreen);
            rt1.UserCellGroups.Add(grp1);


            // row/col span
            ((RenderText)rt1.Cells[14, 1].RenderObject).Text =
                "Column and row spans are fully supported, as well as alignment within the (spanned or not) cells.";
            rt1.Cells[14, 1].SpanCols            = 3;
            rt1.Cells[14, 1].SpanRows            = 5;
            rt1.Cells[14, 1].Style.Font          = new Font("Arial", 12, FontStyle.Bold | FontStyle.Italic);
            rt1.Cells[14, 1].Style.Borders.All   = new LineDef("2pt", Colors.DarkOrange);
            rt1.Cells[14, 1].Style.TextAlignHorz = AlignHorzEnum.Center;
            rt1.Cells[14, 1].Style.TextAlignVert = AlignVertEnum.Center;
            rt1.RowGroups[14, 5].SplitBehavior   = SplitBehaviorEnum.SplitIfLarge;

            return(doc);
        }
コード例 #7
0
ファイル: ReportForm2.cs プロジェクト: gyb333/KDSBase
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ReportForm2));
     this.c1PrintDocument1       = new C1.C1Preview.C1PrintDocument();
     this.c1PrintPreviewControl1 = new C1.Win.C1Preview.C1PrintPreviewControl();
     ((System.ComponentModel.ISupportInitialize)(this.c1PrintPreviewControl1)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.c1PrintPreviewControl1.PreviewPane)).BeginInit();
     this.c1PrintPreviewControl1.SuspendLayout();
     this.SuspendLayout();
     //
     // c1PrintDocument1
     //
     this.c1PrintDocument1.PageLayouts.Default.PageSettings = new C1.C1Preview.C1PageSettings(false, System.Drawing.Printing.PaperKind.A4, false, "25.4mm", "25.4mm", "25.4mm", "25.4mm");
     //
     // c1PrintPreviewControl1
     //
     this.c1PrintPreviewControl1.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.c1PrintPreviewControl1.ImageSet = C1.Win.C1Preview.ImageSetEnum.Adobe;
     this.c1PrintPreviewControl1.Location = new System.Drawing.Point(0, 0);
     this.c1PrintPreviewControl1.Name     = "c1PrintPreviewControl1";
     this.c1PrintPreviewControl1.NavigationPanelVisible = false;
     //
     // c1PrintPreviewControl1.OutlineView
     //
     this.c1PrintPreviewControl1.PreviewOutlineView.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.c1PrintPreviewControl1.PreviewOutlineView.Location = new System.Drawing.Point(0, 0);
     this.c1PrintPreviewControl1.PreviewOutlineView.Name     = "OutlineView";
     this.c1PrintPreviewControl1.PreviewOutlineView.Size     = new System.Drawing.Size(165, 427);
     this.c1PrintPreviewControl1.PreviewOutlineView.TabIndex = 0;
     //
     // c1PrintPreviewControl1.PreviewPane
     //
     this.c1PrintPreviewControl1.PreviewPane.Document = this.c1PrintDocument1;
     this.c1PrintPreviewControl1.PreviewPane.IntegrateExternalTools = true;
     this.c1PrintPreviewControl1.PreviewPane.TabIndex = 0;
     //
     // c1PrintPreviewControl1.PreviewTextSearchPanel
     //
     this.c1PrintPreviewControl1.PreviewTextSearchPanel.Dock        = System.Windows.Forms.DockStyle.Right;
     this.c1PrintPreviewControl1.PreviewTextSearchPanel.Location    = new System.Drawing.Point(530, 0);
     this.c1PrintPreviewControl1.PreviewTextSearchPanel.MinimumSize = new System.Drawing.Size(200, 240);
     this.c1PrintPreviewControl1.PreviewTextSearchPanel.Name        = "PreviewTextSearchPanel";
     this.c1PrintPreviewControl1.PreviewTextSearchPanel.Size        = new System.Drawing.Size(200, 453);
     this.c1PrintPreviewControl1.PreviewTextSearchPanel.TabIndex    = 0;
     this.c1PrintPreviewControl1.PreviewTextSearchPanel.Visible     = false;
     //
     // c1PrintPreviewControl1.ThumbnailView
     //
     this.c1PrintPreviewControl1.PreviewThumbnailView.Dock                = System.Windows.Forms.DockStyle.Fill;
     this.c1PrintPreviewControl1.PreviewThumbnailView.HideSelection       = false;
     this.c1PrintPreviewControl1.PreviewThumbnailView.Location            = new System.Drawing.Point(0, 0);
     this.c1PrintPreviewControl1.PreviewThumbnailView.Name                = "ThumbnailView";
     this.c1PrintPreviewControl1.PreviewThumbnailView.OwnerDraw           = true;
     this.c1PrintPreviewControl1.PreviewThumbnailView.Size                = new System.Drawing.Size(165, 427);
     this.c1PrintPreviewControl1.PreviewThumbnailView.TabIndex            = 0;
     this.c1PrintPreviewControl1.PreviewThumbnailView.ThumbnailSize       = new System.Drawing.Size(96, 96);
     this.c1PrintPreviewControl1.PreviewThumbnailView.UseImageAsThumbnail = false;
     this.c1PrintPreviewControl1.Size             = new System.Drawing.Size(792, 527);
     this.c1PrintPreviewControl1.StatusBarVisible = false;
     this.c1PrintPreviewControl1.TabIndex         = 3;
     this.c1PrintPreviewControl1.Text             = "c1PrintPreviewControl1";
     //
     //
     //
     this.c1PrintPreviewControl1.ToolBars.File.Open.Image = ((System.Drawing.Image)(resources.GetObject("c1PrintPreviewControl1.ToolBars.File.Open.Image")));
     this.c1PrintPreviewControl1.ToolBars.File.Open.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.c1PrintPreviewControl1.ToolBars.File.Open.Name        = "btnFileOpen";
     this.c1PrintPreviewControl1.ToolBars.File.Open.Size        = new System.Drawing.Size(32, 22);
     this.c1PrintPreviewControl1.ToolBars.File.Open.Tag         = "C1PreviewActionEnum.FileOpen";
     this.c1PrintPreviewControl1.ToolBars.File.Open.ToolTipText = "Open File";
     //
     //
     //
     this.c1PrintPreviewControl1.ToolBars.File.PageSetup.Image = ((System.Drawing.Image)(resources.GetObject("c1PrintPreviewControl1.ToolBars.File.PageSetup.Image")));
     this.c1PrintPreviewControl1.ToolBars.File.PageSetup.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.c1PrintPreviewControl1.ToolBars.File.PageSetup.Name        = "btnPageSetup";
     this.c1PrintPreviewControl1.ToolBars.File.PageSetup.Size        = new System.Drawing.Size(23, 22);
     this.c1PrintPreviewControl1.ToolBars.File.PageSetup.Tag         = "C1PreviewActionEnum.PageSetup";
     this.c1PrintPreviewControl1.ToolBars.File.PageSetup.ToolTipText = "Page Setup";
     //
     //
     //
     this.c1PrintPreviewControl1.ToolBars.File.Print.Image = ((System.Drawing.Image)(resources.GetObject("c1PrintPreviewControl1.ToolBars.File.Print.Image")));
     this.c1PrintPreviewControl1.ToolBars.File.Print.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.c1PrintPreviewControl1.ToolBars.File.Print.Name        = "btnPrint";
     this.c1PrintPreviewControl1.ToolBars.File.Print.Size        = new System.Drawing.Size(23, 22);
     this.c1PrintPreviewControl1.ToolBars.File.Print.Tag         = "C1PreviewActionEnum.Print";
     this.c1PrintPreviewControl1.ToolBars.File.Print.ToolTipText = "Print";
     //
     //
     //
     this.c1PrintPreviewControl1.ToolBars.File.Reflow.Image = ((System.Drawing.Image)(resources.GetObject("c1PrintPreviewControl1.ToolBars.File.Reflow.Image")));
     this.c1PrintPreviewControl1.ToolBars.File.Reflow.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.c1PrintPreviewControl1.ToolBars.File.Reflow.Name        = "btnReflow";
     this.c1PrintPreviewControl1.ToolBars.File.Reflow.Size        = new System.Drawing.Size(23, 22);
     this.c1PrintPreviewControl1.ToolBars.File.Reflow.Tag         = "C1PreviewActionEnum.Reflow";
     this.c1PrintPreviewControl1.ToolBars.File.Reflow.ToolTipText = "Reflow";
     //
     //
     //
     this.c1PrintPreviewControl1.ToolBars.File.Save.Image = ((System.Drawing.Image)(resources.GetObject("c1PrintPreviewControl1.ToolBars.File.Save.Image")));
     this.c1PrintPreviewControl1.ToolBars.File.Save.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.c1PrintPreviewControl1.ToolBars.File.Save.Name        = "btnFileSave";
     this.c1PrintPreviewControl1.ToolBars.File.Save.Size        = new System.Drawing.Size(23, 22);
     this.c1PrintPreviewControl1.ToolBars.File.Save.Tag         = "C1PreviewActionEnum.FileSave";
     this.c1PrintPreviewControl1.ToolBars.File.Save.ToolTipText = "Save File";
     //
     //
     //
     this.c1PrintPreviewControl1.ToolBars.Navigation.GoFirst.Image = ((System.Drawing.Image)(resources.GetObject("c1PrintPreviewControl1.ToolBars.Navigation.GoFirst.Image")));
     this.c1PrintPreviewControl1.ToolBars.Navigation.GoFirst.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.c1PrintPreviewControl1.ToolBars.Navigation.GoFirst.Name        = "btnGoFirst";
     this.c1PrintPreviewControl1.ToolBars.Navigation.GoFirst.Size        = new System.Drawing.Size(23, 22);
     this.c1PrintPreviewControl1.ToolBars.Navigation.GoFirst.Tag         = "C1PreviewActionEnum.GoFirst";
     this.c1PrintPreviewControl1.ToolBars.Navigation.GoFirst.ToolTipText = "Go To First Page";
     //
     //
     //
     this.c1PrintPreviewControl1.ToolBars.Navigation.GoLast.Image = ((System.Drawing.Image)(resources.GetObject("c1PrintPreviewControl1.ToolBars.Navigation.GoLast.Image")));
     this.c1PrintPreviewControl1.ToolBars.Navigation.GoLast.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.c1PrintPreviewControl1.ToolBars.Navigation.GoLast.Name        = "btnGoLast";
     this.c1PrintPreviewControl1.ToolBars.Navigation.GoLast.Size        = new System.Drawing.Size(23, 22);
     this.c1PrintPreviewControl1.ToolBars.Navigation.GoLast.Tag         = "C1PreviewActionEnum.GoLast";
     this.c1PrintPreviewControl1.ToolBars.Navigation.GoLast.ToolTipText = "Go To Last Page";
     //
     //
     //
     this.c1PrintPreviewControl1.ToolBars.Navigation.GoNext.Image = ((System.Drawing.Image)(resources.GetObject("c1PrintPreviewControl1.ToolBars.Navigation.GoNext.Image")));
     this.c1PrintPreviewControl1.ToolBars.Navigation.GoNext.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.c1PrintPreviewControl1.ToolBars.Navigation.GoNext.Name        = "btnGoNext";
     this.c1PrintPreviewControl1.ToolBars.Navigation.GoNext.Size        = new System.Drawing.Size(23, 22);
     this.c1PrintPreviewControl1.ToolBars.Navigation.GoNext.Tag         = "C1PreviewActionEnum.GoNext";
     this.c1PrintPreviewControl1.ToolBars.Navigation.GoNext.ToolTipText = "Go To Next Page";
     //
     //
     //
     this.c1PrintPreviewControl1.ToolBars.Navigation.GoPrev.Image = ((System.Drawing.Image)(resources.GetObject("c1PrintPreviewControl1.ToolBars.Navigation.GoPrev.Image")));
     this.c1PrintPreviewControl1.ToolBars.Navigation.GoPrev.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.c1PrintPreviewControl1.ToolBars.Navigation.GoPrev.Name        = "btnGoPrev";
     this.c1PrintPreviewControl1.ToolBars.Navigation.GoPrev.Size        = new System.Drawing.Size(23, 22);
     this.c1PrintPreviewControl1.ToolBars.Navigation.GoPrev.Tag         = "C1PreviewActionEnum.GoPrev";
     this.c1PrintPreviewControl1.ToolBars.Navigation.GoPrev.ToolTipText = "Go To Previous Page";
     //
     //
     //
     this.c1PrintPreviewControl1.ToolBars.Navigation.HistoryNext.Image = ((System.Drawing.Image)(resources.GetObject("c1PrintPreviewControl1.ToolBars.Navigation.HistoryNext.Image")));
     this.c1PrintPreviewControl1.ToolBars.Navigation.HistoryNext.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.c1PrintPreviewControl1.ToolBars.Navigation.HistoryNext.Name        = "btnHistoryNext";
     this.c1PrintPreviewControl1.ToolBars.Navigation.HistoryNext.Size        = new System.Drawing.Size(32, 22);
     this.c1PrintPreviewControl1.ToolBars.Navigation.HistoryNext.Tag         = "C1PreviewActionEnum.HistoryNext";
     this.c1PrintPreviewControl1.ToolBars.Navigation.HistoryNext.ToolTipText = "Next View";
     //
     //
     //
     this.c1PrintPreviewControl1.ToolBars.Navigation.HistoryPrev.Image = ((System.Drawing.Image)(resources.GetObject("c1PrintPreviewControl1.ToolBars.Navigation.HistoryPrev.Image")));
     this.c1PrintPreviewControl1.ToolBars.Navigation.HistoryPrev.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.c1PrintPreviewControl1.ToolBars.Navigation.HistoryPrev.Name        = "btnHistoryPrev";
     this.c1PrintPreviewControl1.ToolBars.Navigation.HistoryPrev.Size        = new System.Drawing.Size(32, 22);
     this.c1PrintPreviewControl1.ToolBars.Navigation.HistoryPrev.Tag         = "C1PreviewActionEnum.HistoryPrev";
     this.c1PrintPreviewControl1.ToolBars.Navigation.HistoryPrev.ToolTipText = "Previous View";
     //
     //
     //
     this.c1PrintPreviewControl1.ToolBars.Navigation.LblOfPages.Name = "lblOfPages";
     this.c1PrintPreviewControl1.ToolBars.Navigation.LblOfPages.Size = new System.Drawing.Size(31, 22);
     this.c1PrintPreviewControl1.ToolBars.Navigation.LblOfPages.Tag  = "C1PreviewActionEnum.GoPageCount";
     this.c1PrintPreviewControl1.ToolBars.Navigation.LblOfPages.Text = "of 0";
     //
     //
     //
     this.c1PrintPreviewControl1.ToolBars.Navigation.LblPage.Name  = "lblPage";
     this.c1PrintPreviewControl1.ToolBars.Navigation.LblPage.Size  = new System.Drawing.Size(37, 22);
     this.c1PrintPreviewControl1.ToolBars.Navigation.LblPage.Tag   = "C1PreviewActionEnum.GoPageLabel";
     this.c1PrintPreviewControl1.ToolBars.Navigation.LblPage.Text  = "Page";
     this.c1PrintPreviewControl1.ToolBars.Navigation.ToolTipPageNo = null;
     //
     //
     //
     this.c1PrintPreviewControl1.ToolBars.Page.Continuous.Checked               = true;
     this.c1PrintPreviewControl1.ToolBars.Page.Continuous.CheckState            = System.Windows.Forms.CheckState.Checked;
     this.c1PrintPreviewControl1.ToolBars.Page.Continuous.Image                 = ((System.Drawing.Image)(resources.GetObject("c1PrintPreviewControl1.ToolBars.Page.Continuous.Image")));
     this.c1PrintPreviewControl1.ToolBars.Page.Continuous.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.c1PrintPreviewControl1.ToolBars.Page.Continuous.Name        = "btnPageContinuous";
     this.c1PrintPreviewControl1.ToolBars.Page.Continuous.Size        = new System.Drawing.Size(23, 22);
     this.c1PrintPreviewControl1.ToolBars.Page.Continuous.Tag         = "C1PreviewActionEnum.PageContinuous";
     this.c1PrintPreviewControl1.ToolBars.Page.Continuous.ToolTipText = "Continuous View";
     //
     //
     //
     this.c1PrintPreviewControl1.ToolBars.Page.Facing.Image = ((System.Drawing.Image)(resources.GetObject("c1PrintPreviewControl1.ToolBars.Page.Facing.Image")));
     this.c1PrintPreviewControl1.ToolBars.Page.Facing.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.c1PrintPreviewControl1.ToolBars.Page.Facing.Name        = "btnPageFacing";
     this.c1PrintPreviewControl1.ToolBars.Page.Facing.Size        = new System.Drawing.Size(23, 22);
     this.c1PrintPreviewControl1.ToolBars.Page.Facing.Tag         = "C1PreviewActionEnum.PageFacing";
     this.c1PrintPreviewControl1.ToolBars.Page.Facing.ToolTipText = "Pages Facing View";
     //
     //
     //
     this.c1PrintPreviewControl1.ToolBars.Page.FacingContinuous.Image = ((System.Drawing.Image)(resources.GetObject("c1PrintPreviewControl1.ToolBars.Page.FacingContinuous.Image")));
     this.c1PrintPreviewControl1.ToolBars.Page.FacingContinuous.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.c1PrintPreviewControl1.ToolBars.Page.FacingContinuous.Name        = "btnPageFacingContinuous";
     this.c1PrintPreviewControl1.ToolBars.Page.FacingContinuous.Size        = new System.Drawing.Size(23, 22);
     this.c1PrintPreviewControl1.ToolBars.Page.FacingContinuous.Tag         = "C1PreviewActionEnum.PageFacingContinuous";
     this.c1PrintPreviewControl1.ToolBars.Page.FacingContinuous.ToolTipText = "Pages Facing Continuous View";
     //
     //
     //
     this.c1PrintPreviewControl1.ToolBars.Page.Single.Image = ((System.Drawing.Image)(resources.GetObject("c1PrintPreviewControl1.ToolBars.Page.Single.Image")));
     this.c1PrintPreviewControl1.ToolBars.Page.Single.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.c1PrintPreviewControl1.ToolBars.Page.Single.Name        = "btnPageSingle";
     this.c1PrintPreviewControl1.ToolBars.Page.Single.Size        = new System.Drawing.Size(23, 22);
     this.c1PrintPreviewControl1.ToolBars.Page.Single.Tag         = "C1PreviewActionEnum.PageSingle";
     this.c1PrintPreviewControl1.ToolBars.Page.Single.ToolTipText = "Single Page View";
     //
     //
     //
     this.c1PrintPreviewControl1.ToolBars.Text.Find.Image = ((System.Drawing.Image)(resources.GetObject("c1PrintPreviewControl1.ToolBars.Text.Find.Image")));
     this.c1PrintPreviewControl1.ToolBars.Text.Find.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.c1PrintPreviewControl1.ToolBars.Text.Find.Name        = "btnFind";
     this.c1PrintPreviewControl1.ToolBars.Text.Find.Size        = new System.Drawing.Size(23, 22);
     this.c1PrintPreviewControl1.ToolBars.Text.Find.Tag         = "C1PreviewActionEnum.Find";
     this.c1PrintPreviewControl1.ToolBars.Text.Find.ToolTipText = "Find Text";
     //
     //
     //
     this.c1PrintPreviewControl1.ToolBars.Text.Hand.Checked               = true;
     this.c1PrintPreviewControl1.ToolBars.Text.Hand.CheckState            = System.Windows.Forms.CheckState.Checked;
     this.c1PrintPreviewControl1.ToolBars.Text.Hand.Image                 = ((System.Drawing.Image)(resources.GetObject("c1PrintPreviewControl1.ToolBars.Text.Hand.Image")));
     this.c1PrintPreviewControl1.ToolBars.Text.Hand.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.c1PrintPreviewControl1.ToolBars.Text.Hand.Name        = "btnHandTool";
     this.c1PrintPreviewControl1.ToolBars.Text.Hand.Size        = new System.Drawing.Size(23, 22);
     this.c1PrintPreviewControl1.ToolBars.Text.Hand.Tag         = "C1PreviewActionEnum.HandTool";
     this.c1PrintPreviewControl1.ToolBars.Text.Hand.ToolTipText = "Hand Tool";
     //
     //
     //
     this.c1PrintPreviewControl1.ToolBars.Text.SelectText.Image = ((System.Drawing.Image)(resources.GetObject("c1PrintPreviewControl1.ToolBars.Text.SelectText.Image")));
     this.c1PrintPreviewControl1.ToolBars.Text.SelectText.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.c1PrintPreviewControl1.ToolBars.Text.SelectText.Name        = "btnSelectTextTool";
     this.c1PrintPreviewControl1.ToolBars.Text.SelectText.Size        = new System.Drawing.Size(23, 22);
     this.c1PrintPreviewControl1.ToolBars.Text.SelectText.Tag         = "C1PreviewActionEnum.SelectTextTool";
     this.c1PrintPreviewControl1.ToolBars.Text.SelectText.ToolTipText = "Text Select Tool";
     //
     //
     //
     this.c1PrintPreviewControl1.ToolBars.Zoom.DropZoomFactor.Name = "dropZoomFactor";
     this.c1PrintPreviewControl1.ToolBars.Zoom.DropZoomFactor.Size = new System.Drawing.Size(13, 22);
     this.c1PrintPreviewControl1.ToolBars.Zoom.DropZoomFactor.Tag  = "C1PreviewActionEnum.ZoomFactor";
     this.c1PrintPreviewControl1.ToolBars.Zoom.ToolTipZoomFactor   = null;
     //
     //
     //
     this.c1PrintPreviewControl1.ToolBars.Zoom.ZoomIn.Image = ((System.Drawing.Image)(resources.GetObject("c1PrintPreviewControl1.ToolBars.Zoom.ZoomIn.Image")));
     this.c1PrintPreviewControl1.ToolBars.Zoom.ZoomIn.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.c1PrintPreviewControl1.ToolBars.Zoom.ZoomIn.Name        = "btnZoomIn";
     this.c1PrintPreviewControl1.ToolBars.Zoom.ZoomIn.Size        = new System.Drawing.Size(23, 22);
     this.c1PrintPreviewControl1.ToolBars.Zoom.ZoomIn.Tag         = "C1PreviewActionEnum.ZoomIn";
     this.c1PrintPreviewControl1.ToolBars.Zoom.ZoomIn.ToolTipText = "Zoom In";
     //
     //
     //
     this.c1PrintPreviewControl1.ToolBars.Zoom.ZoomOut.Image = ((System.Drawing.Image)(resources.GetObject("c1PrintPreviewControl1.ToolBars.Zoom.ZoomOut.Image")));
     this.c1PrintPreviewControl1.ToolBars.Zoom.ZoomOut.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.c1PrintPreviewControl1.ToolBars.Zoom.ZoomOut.Name        = "btnZoomOut";
     this.c1PrintPreviewControl1.ToolBars.Zoom.ZoomOut.Size        = new System.Drawing.Size(23, 22);
     this.c1PrintPreviewControl1.ToolBars.Zoom.ZoomOut.Tag         = "C1PreviewActionEnum.ZoomOut";
     this.c1PrintPreviewControl1.ToolBars.Zoom.ZoomOut.ToolTipText = "Zoom Out";
     //
     //
     //
     this.c1PrintPreviewControl1.ToolBars.Zoom.ZoomTool.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
         this.c1PrintPreviewControl1.ToolBars.Zoom.ZoomInTool,
         this.c1PrintPreviewControl1.ToolBars.Zoom.ZoomOutTool
     });
     this.c1PrintPreviewControl1.ToolBars.Zoom.ZoomTool.Image = ((System.Drawing.Image)(resources.GetObject("c1PrintPreviewControl1.ToolBars.Zoom.ZoomTool.Image")));
     this.c1PrintPreviewControl1.ToolBars.Zoom.ZoomTool.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.c1PrintPreviewControl1.ToolBars.Zoom.ZoomTool.Name        = "btnZoomTool";
     this.c1PrintPreviewControl1.ToolBars.Zoom.ZoomTool.Size        = new System.Drawing.Size(32, 22);
     this.c1PrintPreviewControl1.ToolBars.Zoom.ZoomTool.Tag         = "C1PreviewActionEnum.ZoomInTool";
     this.c1PrintPreviewControl1.ToolBars.Zoom.ZoomTool.ToolTipText = "Zoom In Tool";
     this.c1PrintPreviewControl1.Click += new System.EventHandler(this.c1PrintPreviewControl1_Click);
     //
     // ReportForm2
     //
     this.ClientSize = new System.Drawing.Size(792, 527);
     this.Controls.Add(this.c1PrintPreviewControl1);
     this.Name        = "ReportForm2";
     this.Text        = "报表预览";
     this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
     this.Controls.SetChildIndex(this._txtDefaultFocus, 0);
     this.Controls.SetChildIndex(this.c1PrintPreviewControl1, 0);
     ((System.ComponentModel.ISupportInitialize)(this.c1PrintPreviewControl1.PreviewPane)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.c1PrintPreviewControl1)).EndInit();
     this.c1PrintPreviewControl1.ResumeLayout(false);
     this.c1PrintPreviewControl1.PerformLayout();
     this.ResumeLayout(false);
     this.PerformLayout();
 }
コード例 #8
0
        static public C1PrintDocument TextStyles()
        {
            C1.C1Preview.C1PrintDocument doc = new C1.C1Preview.C1PrintDocument();

            RenderText rtxt = new RenderText(doc);

            rtxt.Text                = "Text styles in C1PrintDocument";
            rtxt.Style.FontName      = "Arial";
            rtxt.Style.FontSize      = 18;
            rtxt.Style.FontBold      = true;
            rtxt.Style.TextAlignHorz = AlignHorzEnum.Center;
            rtxt.Style.Padding.All   = new Unit("5mm");
            doc.Body.Children.Add(rtxt);

            // setup some text styles
            Style s1 = doc.Style.Children.Add();

            s1.TextColor = Colors.Blue;
            s1.FontBold  = true;

            Style s2 = doc.Style.Children.Add();

            s2.BackColor = Colors.Chartreuse;

            Style s3 = doc.Style.Children.Add();

            s3.TextColor = Colors.Red;

            Style s4 = doc.Style.Children.Add();

            s4.FontName   = "Arial";
            s4.FontSize   = 14;
            s4.FontBold   = true;
            s4.FontItalic = true;

            Style s5 = doc.Style.Children.Add();

            s5.BackColor = s2.BackColor;
            s5.TextColor = s3.TextColor;
            s5.Font      = s4.Font;

            RenderParagraph rp = new RenderParagraph(doc);

            ParagraphObject po = new ParagraphText("In ");

            rp.Content.Add(po);
            po = new ParagraphText("C1PrintDocument");
            po.Style.AssignNonInheritedFrom(s1);
            rp.Content.Add(po);
            rp.Content.Add(new ParagraphText(", multi-style text is fully supported via "));
            rp.Content.Add(new ParagraphText("RenderParagraph", Colors.Blue));
            rp.Content.Add(new ParagraphText(" render objects."));

            rp.Content.Add(new ParagraphText("\rWithin a single paragraph, you can change "));

            po = new ParagraphText("background color,");
            po.Style.Parent = s2;
            rp.Content.Add(po);

            po = new ParagraphText(" text color,");
            po.Style.AssignNonInheritedFrom(s3);
            rp.Content.Add(po);

            po = new ParagraphText(" font,");
            po.Style.AssignNonInheritedFrom(s4);
            rp.Content.Add(po);

            po = new ParagraphText(" or all together.");
            po.Style.AssignNonInheritedFrom(s5);
            rp.Content.Add(po);

            rp.Content.Add(new ParagraphText("\rFont sub-properties such as "));
            rp.Content.Add(new ParagraphText("bold, "));
            rp.Content[rp.Content.Count - 1].Style.FontBold = true;
            rp.Content.Add(new ParagraphText("italic "));
            rp.Content[rp.Content.Count - 1].Style.FontItalic = true;
            rp.Content.Add(new ParagraphText("or "));
            rp.Content.Add(new ParagraphText("underline"));
            rp.Content[rp.Content.Count - 1].Style.FontUnderline = true;
            rp.Content.Add(new ParagraphText(" can be individually adjusted."));

            rp.Content.Add(new ParagraphText("\rText positions such as "));
            rp.Content.Add(new ParagraphText("superscript", TextPositionEnum.Superscript));
            rp.Content.Add(new ParagraphText(" and "));
            rp.Content.Add(new ParagraphText("subscript", TextPositionEnum.Subscript));
            rp.Content.Add(new ParagraphText(" are supported."));

            po = new ParagraphText("\rInline images ");
            rp.Content.Add(po);
            System.Drawing.Image inlineImage = System.Drawing.Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("DemoTables.check.png"));
            po = new ParagraphImage(inlineImage);
            rp.Content.Add(po);
            po = new ParagraphText(" can be embedded in the text as well.");
            rp.Content.Add(po);

            doc.Body.Children.Add(rp);

            return(doc);
        }
コード例 #9
0
        private C1.C1Preview.C1PrintDocument makeDoc_TextStyles()
        {
            C1.C1Preview.C1PrintDocument doc = new C1.C1Preview.C1PrintDocument();

            RenderText rtxt = new RenderText(doc);

            rtxt.Text                = "Text styles in the new C1PrintDocument";
            rtxt.Style.Font          = new Font("Arial", 18, FontStyle.Bold);
            rtxt.Style.TextAlignHorz = AlignHorzEnum.Center;
            rtxt.Style.Padding.All   = new Unit("5mm");
            doc.Body.Children.Add(rtxt);

            // setup some text styles
            Style s1 = doc.Style.Children.Add();

            s1.TextColor = Color.Blue;
            s1.Font      = new Font(s1.Font, FontStyle.Bold);

            Style s2 = doc.Style.Children.Add();

            s2.BackColor = Color.Chartreuse;

            Style s3 = doc.Style.Children.Add();

            s3.TextColor = Color.Red;

            Style s4 = doc.Style.Children.Add();

            s4.Font = new Font("Arial", 14, FontStyle.Bold | FontStyle.Italic);

            Style s5 = doc.Style.Children.Add();

            s5.BackColor = s2.BackColor;
            s5.TextColor = s3.TextColor;
            s5.Font      = s4.Font;


            RenderParagraph rp = new RenderParagraph(doc);

            ParagraphObject po = new ParagraphText("In the new ");

            rp.Content.Add(po);
            po = new ParagraphText("C1PrintDocument");
            po.Style.AssignNonInheritedFrom(s1);
            rp.Content.Add(po);
            po = new ParagraphText(" multi-style text is fully supported. You can change ", TextPositionEnum.Normal);
            rp.Content.Add(po);

            po = new ParagraphText("the background color,");
            // po.Style.AssignNonInheritedFrom(s2);
            po.Style.Parent = s2;
            rp.Content.Add(po);

            po = new ParagraphText(" text color,");
            po.Style.AssignNonInheritedFrom(s3);
            rp.Content.Add(po);

            po = new ParagraphText(" font,");
            po.Style.AssignNonInheritedFrom(s4);
            rp.Content.Add(po);

            po = new ParagraphText(" or all together.");
            po.Style.AssignNonInheritedFrom(s5);
            rp.Content.Add(po);

            po = new ParagraphText(" Superscript", TextPositionEnum.Superscript);
            rp.Content.Add(po);

            po = new ParagraphText(" and ");
            rp.Content.Add(po);

            po = new ParagraphText("Subscript", TextPositionEnum.Subscript);
            rp.Content.Add(po);

            po = new ParagraphText(" text can be rendered.");
            rp.Content.Add(po);

            po = new ParagraphText(" Additionally, images ");
            rp.Content.Add(po);
            po = new ParagraphImage(pictureBox2.Image);
            rp.Content.Add(po);
            po = new ParagraphText(" can be embedded in the text as well.");
            rp.Content.Add(po);

            doc.Body.Children.Add(rp);

            return(doc);
        }