Beispiel #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            BrickGraphics brickGraph = printingSystem1.Graph;
            int           top        = 0;

            // Start the report generation.
            printingSystem1.Begin();

            // Specify a page area.
            brickGraph.Modifier = BrickModifier.Detail;

            // Specify formatting.
            brickGraph.StringFormat = new BrickStringFormat(StringAlignment.Center,
                                                            StringAlignment.Center);
            brickGraph.BackColor   = Color.Khaki;
            brickGraph.BorderColor = Color.MidnightBlue;
            brickGraph.Font        = new Font("Tahoma", 14, FontStyle.Bold | FontStyle.Italic);

            // Draw bricks.
            brickGraph.DrawString("Developer Express", Color.MidnightBlue,
                                  new RectangleF(0, 0, 150, 50), BorderSide.All);
            brickGraph.DrawString("100% Native", Color.MidnightBlue,
                                  new RectangleF(0, top += 50, 150, 50), BorderSide.All);
            brickGraph.DrawString(".NET Tecnologies", Color.MidnightBlue,
                                  new RectangleF(0, top += 50, 150, 50), BorderSide.All);

            // Finish the report generation.
            printingSystem1.End();

            // Assign current printing systenm to the PrintControl.
            printControl1.PrintingSystem = printingSystem1;

            // Show the report to the user.
            printControl1.Show();
        }
Beispiel #2
0
        protected override void CreateDetailHeader(BrickGraphics graph)
        {
            // Center a text string horizontally and vertically.
            graph.StringFormat = new BrickStringFormat(StringAlignment.Center, StringAlignment.Center);

            // Set the brick font name to Comic Sans MS, size to 12.
            graph.Font = new Font("Comic Sans MS", 12);

            // Set the background color to Light Green.
            graph.BackColor = Color.LightGreen;

            // Add a text brick with all borders to a specific location
            // with an "I" text string using a Green font color.
            graph.DrawString("I", Color.Green, new Rectangle(0, 0, 150, 25), BorderSide.All);

            // Add a text brick with all borders to a specific location
            // with a "love" text string using a Green font color.
            graph.DrawString("love", Color.Green, new Rectangle(150, 0, 50, 25), BorderSide.All);

            // Add a text brick with all borders to a specific location
            // with a "you" text string using a Green font color.
            graph.DrawString("you", Color.Green, new Rectangle(200, 0, 50, 25), BorderSide.All);

            // Set the line alignment.
            graph.StringFormat = graph.StringFormat.ChangeAlignment(StringAlignment.Near);
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            string        s          = "XtraPrinting Library";
            BrickGraphics brickGraph = printingSystem1.Graph;
            VisualBrick   visBrick   = new VisualBrick();

            // Specify the style
            BrickStyle bStyle = new BrickStyle(BorderSide.Bottom, 2, Color.Gold, Color.Navy,
                                               Color.DodgerBlue, new Font("Arial", 14, FontStyle.Bold | FontStyle.Italic),
                                               new BrickStringFormat(StringAlignment.Far, StringAlignment.Near));

            // Start the report generation.
            printingSystem1.Begin();

            // Create bricks.
            brickGraph.Modifier = BrickModifier.Detail;
            visBrick            = brickGraph.DrawString(s, new RectangleF(0, 0, 250, 40));
            visBrick            = brickGraph.DrawString(s, new RectangleF(0, 40, 250, 40));

            // Apply the style to the current brick.
            visBrick.Style = bStyle;

            // Finish the report generation.
            printingSystem1.End();
        }
Beispiel #4
0
        private void btn_MeasureString1_Click(object sender, EventArgs e)
        {
            VisualBrick   visBrick;
            BrickGraphics brickGraph = printingSystem1.Graph;
            string        s          = "Developer Express Inc.";

            // Determine the visual dimensions of the string
            SizeF sz = brickGraph.MeasureString(s);

            // Start the report generation
            printingSystem1.Begin();

            // Specify a page area
            brickGraph.Modifier = BrickModifier.Detail;

            // Create a rectangle of the calculated size plus the border dimensions
            RectangleF rect = new RectangleF(new PointF(0, 0), sz);

            rect = brickGraph.DefaultBrickStyle.InflateBorderWidth(rect, GraphicsDpi.Pixel);
            rect.Offset(-rect.X, -rect.Y);
            // Add a brick to the report
            visBrick = brickGraph.DrawString(s, Color.Black, rect, BorderSide.All);

            // Finish the report generation
            printingSystem1.End();

            // Preview the report
            printingSystem1.PreviewFormEx.Show();
        }
Beispiel #5
0
        private void btn_MeasureString3_Click(object sender, EventArgs e)
        {
            VisualBrick   visBrick;
            BrickGraphics brickGraph = printingSystem1.Graph;
            string        s          = "Developer Express Inc.";

            // Specify the vertical alignment
            StringFormat sFormat = new StringFormat(StringFormatFlags.DirectionVertical);

            // Measure the string with the specified format and maximum width
            SizeF sz = brickGraph.MeasureString(s, 75, sFormat);

            // Start the report generation
            printingSystem1.Begin();

            // Specify a page area
            brickGraph.Modifier = BrickModifier.Detail;

            // Set default vertical alignment for the text in bricks.
            brickGraph.DefaultBrickStyle.StringFormat = new BrickStringFormat(sFormat);

            // Create a rectangle of the calculated size plus the border dimensions
            RectangleF rect = new RectangleF(new PointF(0, 0), sz);

            rect = brickGraph.DefaultBrickStyle.InflateBorderWidth(rect, GraphicsDpi.Pixel);
            rect.Offset(-rect.X, -rect.Y);
            // Add a text brick to the report
            visBrick = brickGraph.DrawString(s, Color.Black, rect, BorderSide.All);

            // Finish the report generation
            printingSystem1.End();

            // Preview the report
            printingSystem1.PreviewFormEx.Show();
        }
Beispiel #6
0
        private void Link_CreateDetailArea(object sender, CreateAreaEventArgs e)
        {
            int           y             = 0;
            BrickGraphics brickGraphics = e.Graph;

            barCodeControl1.Text = "201801310001";
            barCodeControl1.DrawToBitmap(bitmap, barCodeControl1.ClientRectangle);
            brickGraphics.DrawImage(bitmap, barCodeControl1.ClientRectangle, BorderSide.None, Color.Transparent);

            y += barCodeControl1.Height;
            TextBrick textBrick = brickGraphics.DrawString(barCodeControl1.Text, Color.Black, new RectangleF(0, y, 130, 15), BorderSide.None);

            textBrick.StringFormat = textBrick.StringFormat.ChangeAlignment(StringAlignment.Center);

            y += brickGraphics.Font.Height;
            brickGraphics.DrawString("定价:00", Color.Black, new RectangleF(0, y, 130, 15), BorderSide.None);
        }
Beispiel #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            printingSystem1.Begin();

            // Specify the style definitions.
            BrickStyle column_style1 = new BrickStyle(BorderSide.Left | BorderSide.Bottom | BorderSide.Top, 2,
                                                      Color.Gold, Color.Navy, Color.DodgerBlue, new Font("Arial", 6, FontStyle.Bold |
                                                                                                         FontStyle.Italic), new BrickStringFormat(StringAlignment.Near, StringAlignment.Near));
            BrickStyle column_style2 = new BrickStyle(BorderSide.Top | BorderSide.Bottom, 2,
                                                      Color.Navy, Color.DodgerBlue, Color.Gold, new Font("Arial", 6, FontStyle.Bold |
                                                                                                         FontStyle.Italic), new BrickStringFormat(StringAlignment.Center, StringAlignment.Center));
            BrickStyle column_style3 = new BrickStyle(BorderSide.Right | BorderSide.Bottom | BorderSide.Top, 2,
                                                      Color.DodgerBlue, Color.Gold, Color.Navy, new Font("Arial", 6, FontStyle.Bold |
                                                                                                         FontStyle.Italic), new BrickStringFormat(StringAlignment.Far, StringAlignment.Far));

            BrickGraphics gr = printingSystem1.Graph;

            gr.Modifier = BrickModifier.Detail;
            string    s       = "XtraPrinting Library";
            TextBrick t_brick = new TextBrick();

            // Draw the first column and apply the style.
            for (int i = 0; i < 3; i++)
            {
                t_brick       = gr.DrawString(s, new RectangleF(0, 20 * i, 100, 20));
                t_brick.Style = column_style1;
            }

            // Draw the second column and apply the style.
            for (int i = 0; i < 3; i++)
            {
                t_brick       = gr.DrawString(s, new RectangleF(100, 20 * i, 100, 20));
                t_brick.Style = column_style2;
            }

            // Draw the first column and apply the style.
            for (int i = 0; i < 3; i++)
            {
                t_brick       = gr.DrawString(s, new RectangleF(200, 20 * i, 100, 20));
                t_brick.Style = column_style3;
            }

            printingSystem1.End();
            printingSystem1.PreviewFormEx.Show();
        }
Beispiel #8
0
 protected override void CreateReportFooter(BrickGraphics gr)
 {
     gr.Modifier     = BrickModifier.ReportFooter;
     gr.StringFormat =
         new BrickStringFormat(StringFormatFlags.NoWrap | StringFormatFlags.LineLimit);
     gr.StringFormat = gr.StringFormat.ChangeLineAlignment(StringAlignment.Far);
     gr.Font         = listView.Font;
     gr.DrawString("Created by John Smith", gr.ForeColor,
                   new Rectangle(0, 0, 200, 30), BorderSide.None);
 }
Beispiel #9
0
        protected override void CreateDetail(BrickGraphics graph)
        {
            base.CreateDetail(graph);

            SizeF textSize = graph.MeasureString(Text, (int)Math.Round(graph.ClientPageSize.Width));

            RectangleF rect = new RectangleF(0, 0, graph.ClientPageSize.Width, textSize.Height);

            graph.DrawString(text, rect);
        }
Beispiel #10
0
        // Set the background color to Deep Sky Blue.
        protected override void CreateDetail(BrickGraphics graph)
        {
            graph.BackColor = Color.DeepSkyBlue;

            // Set the border color to Midnight Blue.
            graph.BorderColor = Color.MidnightBlue;

            // Add a text brick with all borders and a "Hello World!" text.
            graph.DrawString(caption, Color.Red, r, BorderSide.All);
        }
Beispiel #11
0
        protected virtual void CreateRow(BrickGraphics graph)
        {
            // Set the brick font name to Arial, size to 14, and set the bold attribute.
            graph.Font = new Font("Arial", 14, FontStyle.Bold);

            // Add a text brick with all borders to a specific location
            // with a "Good-bye!" text using the blue font color.
            graph.DrawString("Good-bye!", Color.Blue,
                             new Rectangle(0, top += 50, 150, 50), BorderSide.All);
        }
Beispiel #12
0
 protected override void CreateDetailFooter(BrickGraphics gr)
 {
     gr.Modifier     = BrickModifier.DetailFooter;
     gr.Font         = listView.Font;
     gr.BackColor    = SystemColors.Control;
     gr.ForeColor    = SystemColors.ControlText;
     gr.StringFormat = new BrickStringFormat(StringFormatFlags.NoWrap);
     gr.StringFormat = gr.StringFormat.ChangeAlignment(StringAlignment.Far);
     gr.DrawString("Total Items: " + Convert.ToString(listView.Items.Count), gr.ForeColor,
                   new Rectangle(0, 0, 60 + listView.Items[0].Bounds.Width, listView.Items[0].Bounds.Height),
                   BorderSide.All);
 }
Beispiel #13
0
        private void btn_BeginEndUnionRect_Click(object sender, EventArgs e)
        {
            BrickGraphics brickGraph = printingSystem1.Graph;
            int           top        = 0;

            // Start the report generation.
            printingSystem1.Begin();

            // Specify a page area.
            brickGraph.Modifier = BrickModifier.Detail;
            // Start drawing a brick group.
            brickGraph.BeginUnionRect();

            // Specify formatting.
            brickGraph.StringFormat = new BrickStringFormat(StringAlignment.Center, StringAlignment.Center);
            brickGraph.BackColor    = Color.Khaki;
            brickGraph.BorderColor  = Color.MidnightBlue;
            brickGraph.Font         = new Font("Tahoma", 14, FontStyle.Bold | FontStyle.Italic);

            // Draw bricks.
            brickGraph.DrawString("Developer Express", Color.MidnightBlue,
                                  new RectangleF(0, 0, 150, 50), BorderSide.All);
            top += 50;
            brickGraph.DrawString("100% Native", Color.MidnightBlue,
                                  new RectangleF(0, top, 150, 50), BorderSide.All);
            top += 50;
            brickGraph.DrawString(".NET Tecnologies", Color.MidnightBlue,
                                  new RectangleF(0, top, 150, 50), BorderSide.All);

            // Finish drawing a brick group.
            brickGraph.EndUnionRect();

            // Finish the report generation.
            printingSystem1.End();

            // Preview the report.
            printingSystem1.PreviewFormEx.Show();
        }
Beispiel #14
0
 protected override void CreateDetail(BrickGraphics gr)
 {
     gr.StringFormat =
         new BrickStringFormat(StringFormatFlags.NoWrap | StringFormatFlags.LineLimit);
     gr.StringFormat = gr.StringFormat.ChangeLineAlignment(StringAlignment.Near);
     for (int i = 0; i < listView.Items.Count; i++)
     {
         gr.Font      = listView.Items[i].Font;
         gr.BackColor = listView.Items[i].BackColor;
         gr.ForeColor = listView.Items[i].ForeColor;
         gr.DrawString(listView.Items[i].Text, gr.ForeColor, listView.Items[i].Bounds,
                       BorderSide.None);
     }
 }
Beispiel #15
0
 protected override void CreateDetailHeader(BrickGraphics gr)
 {
     if (listView.View != View.Details)
     {
         return;
     }
     gr.Modifier     = BrickModifier.DetailHeader;
     gr.Font         = listView.Font;
     gr.BackColor    = SystemColors.Control;
     gr.ForeColor    = SystemColors.ControlText;
     gr.StringFormat = new BrickStringFormat(StringFormatFlags.NoWrap);
     gr.StringFormat = gr.StringFormat.ChangeAlignment(StringAlignment.Near);
     gr.DrawString("Name", gr.ForeColor, listView.Items[0].Bounds, BorderSide.All);
 }
Beispiel #16
0
        private void btn_ChangeFormatFlags_Click(object sender, EventArgs e)
        {
            VisualBrick       visBrick;
            BrickGraphics     brickGraph   = printingSystem1.Graph;
            string            s            = "Developer Express Inc.";
            BrickStringFormat brickSFormat = new BrickStringFormat();

            // Start the report generation.
            printingSystem1.Begin();

            // Specify a page area.
            brickGraph.Modifier = BrickModifier.Detail;

            // Create a rectangle.
            RectangleF rect = new RectangleF(new PointF(0, 0), new SizeF(180, 75));

            // Add a brick to the report.
            visBrick = brickGraph.DrawString(s, Color.MidnightBlue, rect, BorderSide.All);

            // Change the text alignment within the brick
            brickSFormat = visBrick.Style.StringFormat.ChangeFormatFlags(StringFormatFlags.DirectionVertical
                                                                         | StringFormatFlags.DirectionRightToLeft);
            brickGraph.StringFormat = brickSFormat;

            // Create a second rectangle.
            RectangleF rect1 = new RectangleF(new PointF(0, 75), new SizeF(180, 75));

            // Add the next brick to the report.
            visBrick = brickGraph.DrawString(s, Color.MidnightBlue, rect1, BorderSide.All);

            // Finish the report generation.
            printingSystem1.End();

            // Preview the report.
            printingSystem1.PreviewFormEx.Show();
        }
Beispiel #17
0
        protected override void CreateReportHeader(BrickGraphics gr)
        {
            gr.Modifier = BrickModifier.ReportHeader;
            TextBrick textBrick;

            gr.BackColor    = Color.White;
            gr.StringFormat =
                new BrickStringFormat(StringFormatFlags.NoWrap | StringFormatFlags.LineLimit);
            gr.StringFormat = gr.StringFormat.ChangeAlignment(StringAlignment.Center);
            Rectangle r = new Rectangle(0, 0, 200, 30);

            gr.Font   = new Font("Arial", 16);
            textBrick = gr.DrawString("ListView Report", Color.Red, r, BorderSide.None);
            textBrick.StringFormat.ChangeAlignment(StringAlignment.Center);
        }
Beispiel #18
0
        public void DrawString(string s, Font printFont, Color brush, Single x, Single y, Single w, Single h, StringFormat sf, BrickGraphics _G)
        {
            RectangleF r = new RectangleF();

            r.X      = x;
            r.Y      = y;
            r.Width  = w;
            r.Height = h;
            _G.Font  = printFont;
            BrickStringFormat xformat = new BrickStringFormat(sf);

            _G.StringFormat = xformat;
            _G.ForeColor    = brush;
            _G.DrawString(s, brush, r, BorderSide.None);
        }
        protected override void CreateInnerPageHeader(BrickGraphics graph)
        {
            int TopMargin = PrintingSystem.PageSettings.Margins.Top;

            Font _font =
                new System.Drawing.Font("Arial", 13F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));

            graph.Font = _font;
            RectangleF rect = new RectangleF(20, 40, 300, 40);

            try
            {
                Color c = label1ForeColor;
                graph.DrawString(RTitle, c, rect, DevExpress.XtraPrinting.BorderSide.None);
            }
            catch
            {
            }
            base.CreateInnerPageHeader(graph);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            // Start report generation.
            printingSystem1.Begin();

            // Obtain the Printing System's graphics.
            BrickGraphics gr = printingSystem1.Graph;

            // Specify graphics settings.
            gr.Modifier    = BrickModifier.Detail;
            gr.BackColor   = Color.FromArgb(26, 26, 154);
            gr.BorderColor = Color.FromArgb(254, 202, 2);

            // Insert a text brick.
            string    s         = "XtraPrinting Library";
            TextBrick textBrick = new TextBrick();

            textBrick = gr.DrawString(s, Color.FromArgb(67, 145, 252),
                                      new RectangleF(0, 0, 286, 80), BorderSide.All);
            textBrick.Font = new Font("Arial", 20, FontStyle.Bold | FontStyle.Italic);
            BrickStringFormat bsf = new BrickStringFormat(StringAlignment.Center,
                                                          StringAlignment.Center);

            textBrick.StringFormat = bsf;

            // Insert a page break.
            printingSystem1.InsertPageBreak(81);

            // Insert an image brick.
            Image      img        = Image.FromFile(@"..\..\logo.png");
            ImageBrick imageBrick = new ImageBrick();

            imageBrick = gr.DrawImage(img, new RectangleF(0, 81, 286, 81));

            // Finish report generation.
            printingSystem1.End();

            // Display the Print Preview form.
            printingSystem1.PreviewFormEx.Show();
        }
Beispiel #21
0
        private void btn_BrickStringFormat_Click(object sender, EventArgs e)
        {
            VisualBrick   visBrick;
            BrickGraphics brickGraph = printingSystem1.Graph;
            string        s          = "Developer Express Inc.";

            // Specify the string format.
            StringFormat sFormat = new StringFormat(StringFormatFlags.DirectionVertical);

            sFormat.Alignment     = StringAlignment.Center;
            sFormat.LineAlignment = StringAlignment.Center;

            // Create the BrickStringFormat object.
            BrickStringFormat brickSFormat = new BrickStringFormat(sFormat);

            // Measure the string according to the specified format
            SizeF sz = brickGraph.MeasureString(s, 30, sFormat);


            // Start the report generation.
            printingSystem1.Begin();

            // Set the brick string format
            brickGraph.StringFormat = brickSFormat;

            // Create a rectangle.
            RectangleF rect = new RectangleF(new PointF(0, 0), new SizeF(30, 150));

            // Specify a page area.
            brickGraph.Modifier = BrickModifier.Detail;
            // Add a brick to the report.
            visBrick = brickGraph.DrawString(s, Color.MidnightBlue, rect, BorderSide.All);

            // Finish the report generation.
            printingSystem1.End();

            // Preview the report.
            printingSystem1.PreviewFormEx.Show();
        }
Beispiel #22
0
 void link_AfterCreateAreas(object sender, EventArgs e)
 {
     if (_PrintHeader.Contains("对账单"))
     {
         if (!string.IsNullOrEmpty(_palance))
         {
             BrickGraphics bg = new BrickGraphics(ps);
             bg.Font      = new System.Drawing.Font("宋体", 12, FontStyle.Bold);
             bg.BackColor = Color.Transparent;
             bg.DefaultBrickStyle.SetAlignment(DevExpress.Utils.HorzAlignment.Near, DevExpress.Utils.VertAlignment.Center);
             TextBrick text = bg.DrawString(_palance, Color.Black, new RectangleF(0, 20, 750, 21), BorderSide.Right);
         }
         if (!string.IsNullOrEmpty(MainForm.Accounts))
         {
             BrickGraphics bgAccounts = new BrickGraphics(ps);
             bgAccounts.Font      = new System.Drawing.Font("宋体", 14, FontStyle.Bold);
             bgAccounts.BackColor = Color.Transparent;
             bgAccounts.DefaultBrickStyle.SetAlignment(DevExpress.Utils.HorzAlignment.Near, DevExpress.Utils.VertAlignment.Center);
             TextBrick textAccounts = bgAccounts.DrawString(MainForm.Accounts.Replace("\\r\\n", "\r\n"), Color.Black, new RectangleF(0, 40, 450, 120), BorderSide.None);
         }
     }
 }
Beispiel #23
0
        private void Link_CreateDetailArea(object sender, CreateAreaEventArgs e)
        {
            // Specify required settings for the brick graphics.
            BrickGraphics     brickGraphics = e.Graph;
            BrickStringFormat format        = new BrickStringFormat(StringAlignment.Near, StringAlignment.Center);

            brickGraphics.StringFormat = format;
            brickGraphics.BorderColor  = SystemColors.ControlDark;

            // Declare bricks.
            ImageBrick    imageBrick;
            TextBrick     textBrick;
            CheckBoxBrick checkBrick;
            Brick         brick;

            // Declare text strings.
            string[] rows = { "Species No:", "Length (cm):", "Category:", "Common Name:", "Species Name:" },
            desc = { "90070", "30", "Angelfish", "Blue Angelfish", "Pomacanthus nauarchus" };

            string note = "Habitat is around boulders, caves, coral ledges and crevices in shallow waters. " +
                          "Swims alone or in groups. Its color changes dramatically from juvenile to adult. The mature" +
                          " adult fish can startle divers by producing a powerful drumming or thumping sound intended " +
                          "to warn off predators. Edibility is good. Range is the entire Indo-Pacific region.";

            // Define the image to display.
            // Image img = Image.FromFile(@"..\..\angelfish.png");
            Image img = new Bitmap(1, 1);//= Properties.Resources.excel32;

            // Start creation of a non-separable group of bricks.
            brickGraphics.BeginUnionRect();

            // Display the image.
            imageBrick             = brickGraphics.DrawImage(img, new RectangleF(0, 0, 250, 150), BorderSide.All, Color.Transparent);
            imageBrick.Hint        = "Blue Angelfish";
            textBrick              = brickGraphics.DrawString("1", Color.Blue, new RectangleF(5, 5, 30, 15), BorderSide.All);
            textBrick.StringFormat = textBrick.StringFormat.ChangeAlignment(StringAlignment.Center);

            // Display a checkbox.
            checkBrick = brickGraphics.DrawCheckBox(new RectangleF(5, 145, 10, 10), BorderSide.All, Color.White, true);

            // Create a set of bricks, representing a column with species names.
            brickGraphics.BackColor = Color.FromArgb(153, 204, 255);
            brickGraphics.Font      = new Font("Arial", 10, FontStyle.Italic | FontStyle.Bold | FontStyle.Underline);
            for (int i = 0; i < 5; i++)
            {
                // Draw a VisualBrick representing borders for the following TextBrick.
                brick = brickGraphics.DrawRect(new RectangleF(256, 32 * i, 120, 32), BorderSide.All,
                                               Color.Transparent, Color.Empty);

                // Draw the TextBrick with species names.
                textBrick = brickGraphics.DrawString(rows[i], Color.Black, new RectangleF(258, 32 * i + 2, 116, 28),
                                                     BorderSide.All);
            }

            // Create a set of bricks representing a column with the species characteristics.
            brickGraphics.Font      = new Font("Arial", 11, FontStyle.Bold);
            brickGraphics.BackColor = Color.White;
            for (int i = 0; i < 5; i++)
            {
                brick = brickGraphics.DrawRect(new RectangleF(376, 32 * i, brickGraphics.ClientPageSize.Width - 376, 32),
                                               BorderSide.All,
                                               Color.Transparent, brickGraphics.BorderColor);

                // Draw a TextBrick with species characteristics.
                textBrick = brickGraphics.DrawString(desc[i], Color.Indigo, new RectangleF(378, 32 * i + 2,
                                                                                           brickGraphics.ClientPageSize.Width - 380, 28),
                                                     BorderSide.All);

                // For text bricks containing numeric data, set text alignment to Far.
                if (i < 2)
                {
                    textBrick.StringFormat =
                        textBrick.StringFormat.ChangeAlignment(StringAlignment.Far);
                }
            }

            // Drawing the TextBrick with notes.
            brickGraphics.Font      = new Font("Arial", 8);
            brickGraphics.BackColor = Color.Cornsilk;
            textBrick = brickGraphics.DrawString(note, Color.Black, new RectangleF(new PointF(0, 160), new
                                                                                   SizeF(brickGraphics.ClientPageSize.Width, 40)), BorderSide.All);
            textBrick.StringFormat = textBrick.StringFormat.ChangeLineAlignment(StringAlignment.Near);
            textBrick.Hint         = note;

            // Finish the creation of a non-separable group of bricks.
            brickGraphics.EndUnionRect();
        }
Beispiel #24
0
 // Add a text brick without borders containing the "Hello World!" text.
 protected override void CreateDetail(BrickGraphics graph)
 {
     graph.DrawString(caption, Color.Black, r, BorderSide.None);
 }
Beispiel #25
0
        private void CreateReport(PrintingSystem ps, DataView dv, int[] w, string[] s, ImageList iList, int selectColumn, string reportName, Image imgTitle)
        {
            Brick         brick;
            BrickGraphics gr = ps.Graph;

            ps.Begin();

            gr.StringFormat = gr.StringFormat.ChangeLineAlignment(StringAlignment.Center);
            gr.Font         = new Font("Arial", 8, FontStyle.Bold);

            int imgW = 0, imgH = 0;

            if (iList != null)
            {
                imgW = iList.ImageSize.Width;
                imgH = iList.ImageSize.Height;
            }
            int h = gr.Font.Height + 2;

            //header
            int leftCell = 0;
            int headerwidth;

            gr.Modifier     = BrickModifier.DetailHeader;
            gr.StringFormat = gr.StringFormat.ChangeAlignment(StringAlignment.Center);
            gr.BackColor    = SystemColors.Highlight;
            for (int j = 0; j < s.Length; j++)
            {
                headerwidth = w[j];
                if (j == 0)
                {
                    headerwidth += imgW + imgW / 4;
                }
                gr.DrawString(dv.Table.Columns[s[j]].Caption, SystemColors.HighlightText,
                              new RectangleF(leftCell, 0, headerwidth, h), BorderSide.All);
                leftCell += headerwidth;
            }

            //strings
            h               = Math.Max(h, imgH + imgH / 2);
            gr.Modifier     = BrickModifier.Detail;
            gr.StringFormat = gr.StringFormat.ChangeAlignment(StringAlignment.Near);
            gr.Font         = new Font("Arial", 8);

            int hGeneral = 0;
            int hRow     = 0;

            for (int i = 0; i < dv.Count; i++)
            {
                DataRow row = dv[i].Row;
                leftCell = imgW + imgW / 4;

                hRow = 0;
                for (int j = 0; j < s.Length; j++)
                {
                    hRow = Math.Max(hRow, CalcRowHeight(gr, row[s[j]].ToString(), w[j], h));
                }
                if (iList != null)
                {
                    brick       = gr.DrawImage(iList.Images[0], new RectangleF(0, hGeneral + (hRow - imgH) / 2, imgW, imgH), BorderSide.None, Color.Transparent);
                    brick.ID    = row[s[1]].ToString();
                    brick.Url   = "empty";
                    brick.Value = 0;
                }
                for (int j = 0; j < s.Length; j++)
                {
                    if ("+Byte+Decimal+Double+Int16+Int32+Int64+SByte+Single+UInt16++UInt32+UInt64+".IndexOf("+" + dv.Table.Columns[s[j]].DataType.Name + "+") > -1)
                    {
                        gr.StringFormat = gr.StringFormat.ChangeAlignment(StringAlignment.Far);
                    }
                    else
                    {
                        gr.StringFormat = gr.StringFormat.ChangeAlignment(StringAlignment.Near);
                    }
                    if (j == selectColumn)
                    {
                        gr.BackColor = (iList != null) ? Color.SkyBlue : Color.Yellow;
                    }
                    else
                    {
                        gr.BackColor = SystemColors.Window;
                    }
                    gr.DrawString(row[s[j]].ToString(), SystemColors.WindowText, new RectangleF(leftCell, hGeneral, w[j], hRow), BorderSide.All);
                    leftCell += w[j];
                }
                hGeneral += hRow;
            }

            //hyperlink
            if (iList == null)
            {
                gr.Font         = new Font("Arial", 8, FontStyle.Underline);
                gr.StringFormat = gr.StringFormat.ChangeAlignment(StringAlignment.Near);
                gr.BackColor    = Color.Transparent;
                string hLink = "Show Main Report...";
                brick         = gr.DrawString(hLink, Color.Blue, new RectangleF(0, hGeneral + h, gr.MeasureString(hLink).Width + 5, h), BorderSide.None);
                brick.Value   = brick.ID = "Main";
                brick.Url     = "empty";
                brick.Printed = false;
            }

            CreatePageHeader(gr, reportName, imgTitle, (iList != null) ? Color.Blue : Color.Red);
            CreatePageFooter(gr);

            ps.End();
        }
 public void DrawString(string s, Font printFont, Color brush, Single x, Single y, Single w, Single h, StringFormat sf, BrickGraphics _G)
 {
     RectangleF r = new RectangleF();
         r.X = x;
         r.Y = y;
         r.Width = w;
         r.Height = h;
         _G.Font = printFont;
         BrickStringFormat xformat = new BrickStringFormat(sf);
         _G.StringFormat = xformat;
         _G.ForeColor = brush;
         _G.DrawString(s, brush, r, BorderSide.None);
 }
Beispiel #27
0
		protected override void CreateDetail(BrickGraphics graph) 
		{
			graph.DrawString(caption, Color.Black, r, BorderSide.None);
		}
        public bool DrawRows(BrickGraphics g)
        {
            float lastRowBottom = TopMargin;

            try
            {
                #region Declarations
                SolidBrush ForeBrush = new SolidBrush(System.Drawing.Color.Black);
                SolidBrush BackBrush = new SolidBrush(System.Drawing.Color.White);
                Pen TheLinePen = new Pen(System.Drawing.Color.Gray, 1);
                StringFormat cellformat = new StringFormat();
                cellformat.Trimming = StringTrimming.EllipsisCharacter;
                cellformat.FormatFlags = StringFormatFlags.NoWrap | StringFormatFlags.LineLimit;

                RectangleF RowBounds  = new RectangleF(0, 0, 0, 0);

                Font _font_label = new Font("Arial", 8F, FontStyle.Bold, GraphicsUnit.Point, ((System.Byte)(0)));

                Font _font_value = new Font("Arial", 8F, FontStyle.Regular, GraphicsUnit.Point, ((System.Byte)(0)));
                Rectangle iRectangle = new Rectangle(0, 0, 200, 100);

                int X=85;
                bool IsRichText=false;
                bool LastIsRichText=false;
                #endregion

                if (LastPos<=0)
                {
                    #region Last Pos Less than or equal zero
                    for (int i=LastIndex; i<arrLabel.Count; i++)
                    {
                        if(arrLabel[i].ToString()=="------")
                        {
                            if(arrValue[i].ToString()=="RICHTEXT") IsRichText=true;
                            DrawHorizontalLines(g, X);
                        }
                        else
                        {

                        }
                        {
                            if(IsRichText)
                            {
                                g.Font = _font_label;
                                iRectangle.X = 50;
                                iRectangle.Y = X;
                                g.DrawString(arrLabel[i].ToString() + " : ", System.Drawing.Color.Black, iRectangle, BorderSide.None); // 50, X, new StringFormat());
                                X+=20;

                                string s = arrValue[i].ToString();
                                int CarriageReturnCnt=0;
                                foreach(char c in s)
                                {
                                    if(c=='\n') CarriageReturnCnt++;
                                }
                                g.Font = _font_value;
                                iRectangle.X = 50;
                                iRectangle.Y = X;
                                g.DrawString(arrValue[i].ToString(), System.Drawing.Color.Black, iRectangle, BorderSide.None);

                                //g.DrawString(arrValue[i].ToString(), _font_value, new SolidBrush(System.Drawing.Color.Black), 50, X, new StringFormat());
                                X+=CarriageReturnCnt*11;
                                IsRichText=false;
                            }
                            else
                            {

                                g.Font = _font_label;
                                iRectangle.X = 50;
                                iRectangle.Y = X;
                                g.DrawString(arrLabel[i].ToString() + " : ", System.Drawing.Color.Black, iRectangle, BorderSide.None);
                                //g.DrawString(arrLabel[i].ToString() + " : ", _font_label, new SolidBrush(System.Drawing.Color.Black), 50, X, new StringFormat());
                                g.Font = _font_value;
                                iRectangle.X = 210;
                                iRectangle.Y = X;
                                g.DrawString(arrValue[i].ToString(), System.Drawing.Color.Black, iRectangle, BorderSide.None);
                                //g.DrawString(arrValue[i].ToString(), _font_value, new SolidBrush(System.Drawing.Color.Black), 210, X, new StringFormat());
                            }

                        }
                        X+=20;

                        if(X>(PageHeight * PageNumber) - (BottomMargin+TopMargin))
                        {
                            boolContinue=true;
                            LastPos=0;
                            LastIndex=i;
                            LastIsRichText=IsRichText;
                            return true;
                        }
                        else LastPos=1;
                        boolContinue=false;
                    }
                    #endregion
                }

                if(arrValue1!=null)
                {
                    #region arrValue1 Not Equal to 0
                    if (((LastPos==1) && (boolContinue)) || (!boolContinue))
                    {

                        if(!boolContinue)  LastIndex=0;

                        if(arrValue1.Count>0)
                        {
                            #region arrValue1 Count is greater than zero
                            for (int i=LastIndex; i<arrLabel1.Count; i++)
                            {
                                if(arrLabel1[i].ToString()=="------")
                                {
                                    DrawHorizontalLines(g, X);
                                    X+=15;
                                    g.Font = _font_label;
                                    iRectangle.X = 50;
                                    iRectangle.Y = X;
                                    g.DrawString("Initial Test Event >>", System.Drawing.Color.Black, iRectangle, BorderSide.None);
                                    //g.DrawString("Initial Test Event >>", _font_label, new SolidBrush(System.Drawing.Color.Black), 50, X, new StringFormat());
                                    X+=10;
                                }
                                else
                                {
                                    g.Font = _font_label;
                                    iRectangle.X = 50;
                                    iRectangle.Y = X;
                                    g.DrawString(arrLabel1[i].ToString() + " : ", System.Drawing.Color.Black, iRectangle, BorderSide.None);

                                    g.Font = _font_value;
                                    iRectangle.X = 210;
                                    iRectangle.Y = X;
                                    g.DrawString(arrValue1[i].ToString(), System.Drawing.Color.Black, iRectangle, BorderSide.None);
                                 //   g.DrawString(arrValue1[i].ToString(), _font_value, new SolidBrush(System.Drawing.Color.Black), 210, X, new StringFormat());

                                }

                                if((arrLabel1[i].ToString()=="Instructor Change Reason") ||
                                    (arrLabel1[i].ToString()=="Exception Reason") ||
                                    (arrLabel1[i].ToString()=="Description") ||
                                    (arrLabel1[i].ToString()=="Note"))
                                {
                                    X+=30;
                                }
                                else
                                {
                                    X+=20;
                                }

                                if(X>(PageHeight * PageNumber) - (BottomMargin+TopMargin))
                                {
                                    boolContinue=true;
                                    LastPos=1;
                                    LastIndex=i;
                                    LastIsRichText=IsRichText;
                                    return true;
                                }
                                else LastPos=2;
                                boolContinue=false;
                            }
                            #endregion
                        }
                        else LastPos=2;
                    }

                    if(arrValue2!=null)
                    {
                        #region arrValue2 IS NOT NULL
                        if (((LastPos==2) && (boolContinue)) || (!boolContinue))
                        {
                            if(!boolContinue)  LastIndex=0;

                            if(arrValue2.Count>0)
                            {
                                for(int i=LastIndex; i<arrLabel1.Count; i++)
                                {
                                    if(arrLabel1[i].ToString()=="------")
                                    {
                                        DrawHorizontalLines(g, X);
                                        X+=15;

                                        g.Font = _font_label;
                                        iRectangle.X = 50;
                                        iRectangle.Y = X;
                                        g.DrawString("MidTerm Test Event >>", System.Drawing.Color.Black, iRectangle, BorderSide.None);

                                        //g.DrawString("MidTerm Test Event >>", _font_label, new SolidBrush(System.Drawing.Color.Black), 50, X, new StringFormat());
                                        X+=10;
                                    }
                                    else
                                    {
                                        g.Font = _font_label;
                                        iRectangle.X = 50;
                                        iRectangle.Y = X;
                                        g.DrawString(arrLabel1[i].ToString() + " : ", System.Drawing.Color.Black, iRectangle, BorderSide.None);

                                        //g.DrawString(arrLabel1[i].ToString() + " : ", _font_label, new SolidBrush(System.Drawing.Color.Black), 50, X, new StringFormat());

                                        g.Font = _font_value;
                                        iRectangle.X = 210;
                                        iRectangle.Y = X;
                                        g.DrawString(arrValue2[i].ToString(), System.Drawing.Color.Black, iRectangle, BorderSide.None);

                                        //g.DrawString(arrValue2[i].ToString(), _font_value, new SolidBrush(System.Drawing.Color.Black), 210, X, new StringFormat());

                                    }
                                    if((arrLabel1[i].ToString()=="Instructor Change Reason") ||
                                        (arrLabel1[i].ToString()=="Exception Reason") ||
                                        (arrLabel1[i].ToString()=="Description") ||
                                        (arrLabel1[i].ToString()=="Note"))
                                    {
                                        X+=30;
                                    }
                                    else
                                    {
                                        X+=20;
                                    }

                                    if(X>(PageHeight * PageNumber) - (BottomMargin+TopMargin))
                                    {
                                        boolContinue=true;
                                        LastPos=2;
                                        LastIndex=i;
                                        LastIsRichText=IsRichText;
                                        return true;
                                    }
                                    else LastPos=3;
                                    boolContinue=false;
                                }
                            }
                        }
                        else LastPos=3;
                        #endregion
                    }

                    if(arrValue3!=null)
                    {
                        #region arrValue3 IS NOT NULL
                        if (((LastPos==3) && (boolContinue)) || (!boolContinue))
                        {
                            if(!boolContinue)  LastIndex=0;
                            if(arrValue3.Count>0)
                            {
                                for(int i=LastIndex; i<arrLabel1.Count; i++)
                                {
                                    if(arrLabel1[i].ToString()=="------")
                                    {
                                        DrawHorizontalLines(g, X);
                                        X+=15;

                                        g.Font = _font_label;
                                        iRectangle.X = 50;
                                        iRectangle.Y = X;
                                        g.DrawString("Final Test Event >>", System.Drawing.Color.Black, iRectangle, BorderSide.None);
                                        //g.DrawString("Final Test Event >>", _font_label, new SolidBrush(System.Drawing.Color.Black), 50, X, new StringFormat());
                                        X+=10;
                                    }
                                    else
                                    {
                                        g.Font = _font_label;
                                        iRectangle.X = 50;
                                        iRectangle.Y = X;
                                        g.DrawString(arrLabel1[i].ToString() + " : ", System.Drawing.Color.Black, iRectangle, BorderSide.None);
                                        //g.DrawString(arrLabel1[i].ToString() + " : ", _font_label, new SolidBrush(System.Drawing.Color.Black), 50, X, new StringFormat());

                                        g.Font = _font_value;
                                        iRectangle.X = 210;
                                        iRectangle.Y = X;
                                        g.DrawString(arrValue3[i].ToString(), System.Drawing.Color.Black, iRectangle, BorderSide.None);
                                        //g.DrawString(arrValue3[i].ToString(), _font_value, new SolidBrush(System.Drawing.Color.Black), 210, X, new StringFormat());

                                    }
                                    if((arrLabel1[i].ToString()=="Instructor Change Reason") ||
                                        (arrLabel1[i].ToString()=="Exception Reason") ||
                                        (arrLabel1[i].ToString()=="Description") ||
                                        (arrLabel1[i].ToString()=="Note"))
                                    {
                                        X+=30;
                                    }
                                    else
                                    {
                                        X+=20;
                                    }

                                    if(X>(PageHeight * PageNumber) - (BottomMargin+TopMargin))
                                    {
                                        boolContinue=true;
                                        LastPos=3;
                                        LastIndex=i;
                                        LastIsRichText=IsRichText;
                                        return true;
                                    }
                                    else LastPos=3;
                                    boolContinue=false;
                                }
                            }
                        }
                        #endregion
                    }
                    #endregion
                }

                return false;

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
                return false;
            }
        }
        protected override void CreateInnerPageHeader(BrickGraphics graph)
        {
            int TopMargin = PrintingSystem.PageSettings.Margins.Top;

            Font _font =
                new System.Drawing.Font("Arial", 13F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            graph.Font = _font;
            RectangleF rect = new RectangleF(20, 40, 300, 40);
            try
            {
                Color c = label1ForeColor;
                graph.DrawString(RTitle, c, rect, DevExpress.XtraPrinting.BorderSide.None);
            }
            catch (Exception ex)
            {

            }
            base.CreateInnerPageHeader(graph);
        }
Beispiel #30
0
        private void button1_Click(object sender, EventArgs e)
        {
            BrickGraphics     gr  = printingSystem1.Graph;
            BrickStringFormat bsf = new BrickStringFormat(StringAlignment.Near, StringAlignment.Center);

            gr.StringFormat = bsf;
            gr.BorderColor  = SystemColors.ControlDark;

            // Declare bricks.
            ImageBrick     imagebrick;
            TextBrick      textbrick;
            CheckBoxBrick  checkbrick;
            Brick          brick;
            PageInfoBrick  pageinfobr;
            PageImageBrick pageimagebr;

            // Declare text strings.
            string[] rows = { "Species No:", "Length (cm):", "Category:", "Common Name:", "Species Name:" },
            desc = { "90070", "30", "Angelfish", "Blue Angelfish", "Pomacanthus nauarchus" };

            string note = "Habitat is around boulders, caves, coral ledges and crevices in shallow waters. " +
                          "Swims alone or in groups. Its color changes dramatically from juvenile to adult. The mature " +
                          "adult fish can startle divers by producing a powerful drumming or thumping sound intended " +
                          "to warn off predators. Edibility is good. Range is the entire Indo-Pacific region.",
                   devexpress = "XtraPrintingSystem by Developer Express Inc.";

            // Define the images to display.
            Image img = Image.FromFile(@"..\..\angelfish.png"), pageimage = Image.FromFile(@"..\..\logo.png");

            printingSystem1.PageSettings.Landscape = false;

            printingSystem1.Begin();

            // Detail section creation.
            gr.Modifier = BrickModifier.Detail;

            // Start creation of a non-separable group of bricks.
            gr.BeginUnionRect();

            // Display the image.
            imagebrick             = gr.DrawImage(img, new RectangleF(0, 0, 250, 150), BorderSide.All, Color.Transparent);
            imagebrick.Hint        = "Blue Angelfish";
            textbrick              = gr.DrawString("1", Color.Blue, new RectangleF(5, 5, 30, 15), BorderSide.All);
            textbrick.StringFormat = textbrick.StringFormat.ChangeAlignment(StringAlignment.Center);

            // Display a checkbox.
            checkbrick = gr.DrawCheckBox(new RectangleF(5, 145, 10, 10), BorderSide.All, Color.White, true);

            // Create a set of bricks, representing a column with species names.
            gr.BackColor = Color.FromArgb(153, 204, 255);
            gr.Font      = new Font("Arial", 10, FontStyle.Italic | FontStyle.Bold | FontStyle.Underline);
            for (int i = 0; i < 5; i++)
            {
                // Draw a VisualBrick representing borders for the following TextBrick.
                brick = gr.DrawRect(new RectangleF(256, 32 * i, 120, 32), BorderSide.All,
                                    Color.Transparent, Color.Empty);

                // Draw the TextBrick with species names.
                textbrick = gr.DrawString(rows[i], Color.Black, new RectangleF(258, 32 * i + 2, 116, 28),
                                          BorderSide.All);
            }

            // Create a set of bricks representing a column with the species characteristics.
            gr.Font      = new Font("Arial", 11, FontStyle.Bold);
            gr.BackColor = Color.White;
            for (int i = 0; i < 5; i++)
            {
                brick = gr.DrawRect(new RectangleF(376, 32 * i, gr.ClientPageSize.Width - 376, 32),
                                    BorderSide.All,
                                    Color.Transparent, gr.BorderColor);

                // Draw a TextBrick with species characteristics.
                textbrick = gr.DrawString(desc[i], Color.Indigo, new RectangleF(378, 32 * i + 2,
                                                                                gr.ClientPageSize.Width - 380, 28),
                                          BorderSide.All);

                // For text bricks containing numeric data, set text alignment to Far.
                if (i < 2)
                {
                    textbrick.StringFormat = textbrick.StringFormat.ChangeAlignment(StringAlignment.Far);
                }
            }

            // Drawing the TextBrick with notes.
            gr.Font      = new Font("Arial", 8);
            gr.BackColor = Color.Cornsilk;
            textbrick    = gr.DrawString(note, Color.Black, new RectangleF(new PointF(0, 160), new
                                                                           SizeF(gr.ClientPageSize.Width, 40)), BorderSide.All);
            textbrick.StringFormat = textbrick.StringFormat.ChangeLineAlignment(StringAlignment.Near);
            textbrick.Hint         = note;

            // Finish the creation of a non-separable group of bricks.
            gr.EndUnionRect();

            // Create a MarginalHeader section.
            gr.Modifier = BrickModifier.MarginalHeader;
            RectangleF r = RectangleF.Empty;

            r.Height     = 20;
            gr.BackColor = Color.White;

            // Display the DevExpress text string.
            SizeF sz = gr.MeasureString(devexpress);

            pageinfobr = gr.DrawPageInfo(PageInfo.None, devexpress, Color.Black, new RectangleF(new
                                                                                                PointF(343 - (sz.Width - pageimage.Width) / 2, pageimage.Height + 3), sz), BorderSide.None);
            pageinfobr.Alignment = BrickAlignment.Center;

            // Display the PageImageBrick containing the Developer Express logo.
            pageimagebr = gr.DrawPageImage(pageimage, new RectangleF(343, 0, pageimage.Width, pageimage.Height),
                                           BorderSide.None, Color.Transparent);
            pageimagebr.Alignment = BrickAlignment.Center;

            // Display the PageInfoBrick containing date-time information. Date-time information is displayed
            // in the left part of the MarginalHeader section using the FullDateTimePattern.
            pageinfobr           = gr.DrawPageInfo(PageInfo.DateTime, "{0:F}", Color.Black, r, BorderSide.None);
            pageinfobr.Alignment = BrickAlignment.Near;

            // Display the PageInfoBrick containing the page number among total pages. The page number
            // is displayed in the right part of the MarginalHeader section.
            pageinfobr = gr.DrawPageInfo(PageInfo.NumberOfTotal, "Page {0} of {1}", Color.Black, r,
                                         BorderSide.None);
            pageinfobr.Alignment = BrickAlignment.Far;

            printingSystem1.End();
            printingSystem1.PreviewFormEx.Show();
        }
Beispiel #31
0
        public bool DrawClass(BrickGraphics g)
        {
            float lastRowBottom = TopMargin;

            try
            {
                #region Declarations

                SolidBrush   ForeBrush  = new SolidBrush(System.Drawing.Color.Black);
                SolidBrush   BackBrush  = new SolidBrush(System.Drawing.Color.White);
                Pen          TheLinePen = new Pen(System.Drawing.Color.Gray, 1);
                StringFormat cellformat = new StringFormat();
                cellformat.Trimming    = StringTrimming.EllipsisCharacter;
                cellformat.FormatFlags = StringFormatFlags.NoWrap | StringFormatFlags.LineLimit;

                RectangleF RowBounds = new RectangleF(0, 0, 0, 0);

                Font      _font_label = new Font("Arial", 8F, FontStyle.Bold, GraphicsUnit.Point, ((System.Byte)(0)));
                Font      _font_value = new Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
                Rectangle iRectangle  = new Rectangle(0, 0, 200, 100);

                int  X              = 85;
                bool IsRichText     = false;
                bool LastIsRichText = false;
                #endregion
                if (LastPos <= 0)
                {
                    for (int i = LastIndex; i < arrLabel.Count; i++)
                    {
                        if (arrLabel[i].ToString() == "------")
                        {
                            if (arrValue[i].ToString() == "RICHTEXT")
                            {
                                IsRichText = true;
                            }
                            DrawHorizontalLines(g, (float)X);
                        }
                        else
                        {
                            if (IsRichText)
                            {
                                g.Font       = _font_label;
                                iRectangle.X = 50;
                                iRectangle.Y = X;
                                g.DrawString(arrLabel[i].ToString() + " : ", System.Drawing.Color.Black, iRectangle, BorderSide.None);

                                //g.DrawString(arrLabel[i].ToString() + " : ", _font_label, new SolidBrush(System.Drawing.Color.Black), 50, X, new StringFormat());
                                X += 20;

                                string s = arrValue[i].ToString();
                                int    CarriageReturnCnt = 0;
                                foreach (char c in s)
                                {
                                    if (c == '\n')
                                    {
                                        CarriageReturnCnt++;
                                    }
                                }

                                g.Font       = _font_value;
                                iRectangle.X = 50;
                                iRectangle.Y = X;
                                g.DrawString(arrValue[i].ToString(), System.Drawing.Color.Black, iRectangle, BorderSide.None);
                                //g.DrawString(arrValue[i].ToString(), _font_value, new SolidBrush(System.Drawing.Color.Black), 50, X, new StringFormat());
                                X         += CarriageReturnCnt * 11;
                                IsRichText = false;
                            }
                            else
                            {
                                g.Font       = _font_label;
                                iRectangle.X = 50;
                                iRectangle.Y = X;
                                g.DrawString(arrLabel[i].ToString() + " : ", System.Drawing.Color.Black, iRectangle, BorderSide.None);
                                //g.DrawString(arrLabel[i].ToString() + " : ", _font_label, new SolidBrush(System.Drawing.Color.Black), 50, X, new StringFormat());

                                g.Font       = _font_value;
                                iRectangle.X = 210;
                                iRectangle.Y = X;
                                g.DrawString(arrValue[i].ToString(), System.Drawing.Color.Black, iRectangle, BorderSide.None);
                                //g.DrawString(arrValue[i].ToString(), _font_value, new SolidBrush(System.Drawing.Color.Black), 210, X, new StringFormat());
                            }
                        }
                        X += 20;

                        if (X > (PageHeight) - (BottomMargin + TopMargin))
                        {
                            boolContinue   = true;
                            LastPos        = 0;
                            LastIndex      = i;
                            LastIsRichText = IsRichText;
                            return(true);
                        }
                        else
                        {
                            LastPos = 1;
                        }
                        boolContinue = false;
                    }
                }

                if (arrValue4 != null)
                {
                    if (((LastPos == 1) && (boolContinue)) || (!boolContinue))
                    {
                        if (!boolContinue)
                        {
                            LastIndex = 0;
                        }

                        if (arrValue4.Count > 0)
                        {
                            for (int i = LastIndex; i < arrLabel1.Count; i++)
                            {
                                if (arrLabel1[i].ToString() == "------")
                                {
                                    DrawHorizontalLines(g, X);
                                    X           += 15;
                                    g.Font       = _font_label;
                                    iRectangle.X = 50;
                                    iRectangle.Y = X;
                                    g.DrawString("Class Event >>", Color.Black, iRectangle, BorderSide.None);
                                    //g.DrawString("Class Event >>", _font_label, new SolidBrush(System.Drawing.Color.Black), 50, X, new StringFormat());
                                    X += 10;
                                }
                                else
                                {
                                    g.Font       = _font_label;
                                    iRectangle.X = 50;
                                    iRectangle.Y = X;
                                    g.DrawString(arrLabel1[i].ToString() + " : ", Color.Black, iRectangle, BorderSide.None);
                                    //g.DrawString(arrLabel1[i].ToString() + " : ", _font_label, new SolidBrush(System.Drawing.Color.Black), 50, X, new StringFormat());

                                    g.Font       = _font_value;
                                    iRectangle.X = 210;
                                    iRectangle.Y = X;
                                    g.DrawString(arrValue4[i].ToString() + " : ", Color.Black, iRectangle, BorderSide.None);
                                    //g.DrawString(arrValue4[i].ToString(), _font_value, new SolidBrush(System.Drawing.Color.Black), 210, X, new StringFormat());
                                }

                                if ((arrLabel1[i].ToString() == "Instructor Change Reason") ||
                                    (arrLabel1[i].ToString() == "Exception Reason") ||
                                    (arrLabel1[i].ToString() == "Description") ||
                                    (arrLabel1[i].ToString() == "Note"))
                                {
                                    X += 30;
                                }
                                else
                                {
                                    X += 20;
                                }

                                if (X > (PageHeight) - (BottomMargin + TopMargin))
                                {
                                    boolContinue   = true;
                                    LastPos        = 1;
                                    LastIndex      = i;
                                    LastIsRichText = IsRichText;
                                    return(true);
                                }
                                else
                                {
                                    LastPos = 2;
                                }
                                boolContinue = false;
                            }
                        }
                        else
                        {
                            LastPos = 2;
                        }
                    }

                    if (arrValue1 != null)
                    {
                        if (((LastPos == 2) && (boolContinue)) || (!boolContinue))
                        {
                            if (!boolContinue)
                            {
                                LastIndex = 0;
                            }

                            if (arrValue1.Count > 0)
                            {
                                for (int i = LastIndex; i < arrLabel1.Count; i++)
                                {
                                    if (arrLabel1[i].ToString() == "------")
                                    {
                                        DrawHorizontalLines(g, X);
                                        X           += 15;
                                        g.Font       = _font_label;
                                        iRectangle.X = 50;
                                        iRectangle.Y = X;
                                        g.DrawString("Initial Test Event >>", Color.Black, iRectangle, BorderSide.None);
                                        //g.DrawString("Initial Test Event >>", _font_label, new SolidBrush(System.Drawing.Color.Black), 50, X, new StringFormat());
                                        X += 10;
                                    }
                                    else
                                    {
                                        g.Font       = _font_label;
                                        iRectangle.X = 50;
                                        iRectangle.Y = X;
                                        g.DrawString(arrLabel1[i].ToString() + " : ", Color.Black, iRectangle, BorderSide.None);
                                        //g.DrawString(arrLabel1[i].ToString() + " : ", _font_label, new SolidBrush(System.Drawing.Color.Black), 50, X, new StringFormat());

                                        g.Font       = _font_value;
                                        iRectangle.X = 210;
                                        iRectangle.Y = X;
                                        g.DrawString(arrValue1[i].ToString(), Color.Black, iRectangle, BorderSide.None);
                                        //g.DrawString(arrValue1[i].ToString(), _font_value, new SolidBrush(System.Drawing.Color.Black), 210, X, new StringFormat());
                                    }
                                    if ((arrLabel1[i].ToString() == "Instructor Change Reason") ||
                                        (arrLabel1[i].ToString() == "Exception Reason") ||
                                        (arrLabel1[i].ToString() == "Description") ||
                                        (arrLabel1[i].ToString() == "Note"))
                                    {
                                        X += 30;
                                    }
                                    else
                                    {
                                        X += 20;
                                    }

                                    if (X > (PageHeight) - (BottomMargin + TopMargin))
                                    {
                                        boolContinue   = true;
                                        LastPos        = 2;
                                        LastIndex      = i;
                                        LastIsRichText = IsRichText;
                                        return(true);
                                    }
                                    else
                                    {
                                        LastPos = 3;
                                    }
                                    boolContinue = false;
                                }
                            }
                        }
                        else
                        {
                            LastPos = 3;
                        }
                    }

                    if (arrValue2 != null)
                    {
                        if (((LastPos == 3) && (boolContinue)) || (!boolContinue))
                        {
                            if (!boolContinue)
                            {
                                LastIndex = 0;
                            }
                            if (arrValue2.Count > 0)
                            {
                                for (int i = LastIndex; i < arrLabel1.Count; i++)
                                {
                                    if (arrLabel1[i].ToString() == "------")
                                    {
                                        DrawHorizontalLines(g, X);
                                        X           += 15;
                                        g.Font       = _font_label;
                                        iRectangle.X = 50;
                                        iRectangle.Y = X;
                                        g.DrawString("MidTerm Test Event >>", Color.Black, iRectangle, BorderSide.None);
                                        //g.DrawString("MidTerm Test Event >>", _font_label, new SolidBrush(System.Drawing.Color.Black), 50, X, new StringFormat());
                                        X += 10;
                                    }
                                    else
                                    {
                                        g.Font       = _font_label;
                                        iRectangle.X = 50;
                                        iRectangle.Y = X;
                                        g.DrawString(arrLabel1[i].ToString() + " : ", Color.Black, iRectangle, BorderSide.None);
                                        //g.DrawString(arrLabel1[i].ToString() + " : ", _font_label, new SolidBrush(System.Drawing.Color.Black), 50, X, new StringFormat());

                                        g.Font       = _font_value;
                                        iRectangle.X = 210;
                                        iRectangle.Y = X;
                                        g.DrawString(arrValue2[i].ToString(), Color.Black, iRectangle, BorderSide.None);

                                        //g.DrawString(arrValue2[i].ToString(), _font_value, new SolidBrush(System.Drawing.Color.Black), 210, X, new StringFormat());
                                    }
                                    if ((arrLabel1[i].ToString() == "Instructor Change Reason") ||
                                        (arrLabel1[i].ToString() == "Exception Reason") ||
                                        (arrLabel1[i].ToString() == "Description") ||
                                        (arrLabel1[i].ToString() == "Note"))
                                    {
                                        X += 30;
                                    }
                                    else
                                    {
                                        X += 20;
                                    }

                                    if (X > (PageHeight) - (BottomMargin + TopMargin))
                                    {
                                        boolContinue   = true;
                                        LastPos        = 3;
                                        LastIndex      = i;
                                        LastIsRichText = IsRichText;
                                        return(true);
                                    }
                                    else
                                    {
                                        LastPos = 4;
                                    }
                                    boolContinue = false;
                                }
                            }
                        }
                        else
                        {
                            LastPos = 4;
                        }
                    }
                }

                if (arrValue3 != null)
                {
                    if (((LastPos == 4) && (boolContinue)) || (!boolContinue))
                    {
                        if (!boolContinue)
                        {
                            LastIndex = 0;
                        }
                        if (arrValue3.Count > 0)
                        {
                            for (int i = LastIndex; i < arrLabel1.Count; i++)
                            {
                                if (arrLabel1[i].ToString() == "------")
                                {
                                    DrawHorizontalLines(g, X);
                                    X           += 15;
                                    g.Font       = _font_label;
                                    iRectangle.X = 50;
                                    iRectangle.Y = X;
                                    g.DrawString("Final Test Event >>", Color.Black, iRectangle, BorderSide.None);
                                    //g.DrawString("Final Test Event >>", _font_label, new SolidBrush(System.Drawing.Color.Black), 50, X, new StringFormat());
                                    X += 10;
                                }
                                else
                                {
                                    g.Font       = _font_label;
                                    iRectangle.X = 50;
                                    iRectangle.Y = X;
                                    g.DrawString(arrLabel1[i].ToString() + " : ", Color.Black, iRectangle, BorderSide.None);
                                    //g.DrawString(arrLabel1[i].ToString() + " : ", _font_label, new SolidBrush(System.Drawing.Color.Black), 50, X, new StringFormat());

                                    g.Font       = _font_value;
                                    iRectangle.X = 210;
                                    iRectangle.Y = X;
                                    g.DrawString(arrValue3[i].ToString() + " : ", Color.Black, iRectangle, BorderSide.None);
                                    //g.DrawString(arrValue3[i].ToString(), _font_value, new SolidBrush(System.Drawing.Color.Black), 210, X, new StringFormat());
                                }
                                if ((arrLabel1[i].ToString() == "Instructor Change Reason") ||
                                    (arrLabel1[i].ToString() == "Exception Reason") ||
                                    (arrLabel1[i].ToString() == "Description") ||
                                    (arrLabel1[i].ToString() == "Note"))
                                {
                                    X += 30;
                                }
                                else
                                {
                                    X += 20;
                                }

                                if (X > (PageHeight) - (BottomMargin + TopMargin))
                                {
                                    boolContinue   = true;
                                    LastPos        = 4;
                                    LastIndex      = i;
                                    LastIsRichText = IsRichText;
                                    return(true);
                                }
                                else
                                {
                                    LastPos = 5;
                                }
                                boolContinue = false;
                            }
                        }
                    }
                }


                return(false);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
                return(false);
            }
        }
        private void CreateTableOfValues()
        {
            BrickGraphics gr = ps.Graph;

            ps.Begin();
            double sum   = 0;
            int    count = 0;
            int    h     = 20;

            int X = Convert.ToInt32(Math.Floor(gr.ClientPageSize.Width / 5));

            gr.StringFormat = new BrickStringFormat(StringAlignment.Center,
                                                    StringAlignment.Center);

            // Display column headers.
            gr.Modifier = BrickModifier.DetailHeader;

            for (int i = 0; i < 2; i++)
            {
                gr.DrawString(Operation[i], Color.Black,
                              new RectangleF(i * X, 0, X, h), BorderSide.All);
            }

            // Display  random values.
            gr.Modifier  = BrickModifier.Detail;
            gr.BackColor = SystemColors.Window;
            gr.Font      = new Font("Arial", 8);

            double v;
            Random rand = new Random();

            for (int j = 0; j < 10; j++)
            {
                v = rand.NextDouble() * 100;
                for (int i = 0; i < 2; i++)
                {
                    TextBrick brick = gr.DrawString(String.Format("{0:0.##}", v), Color.Black,
                                                    new RectangleF(i * X, j * h, X, h), BorderSide.All);

                    // Assign the column identificator.
                    brick.ID = Operation[i];

                    // Assign the value used for subsequent calculations.
                    brick.TextValue = v.ToString();
                }

                count++;
                sum += v;
            }

            // Display the count and sum values in the ReportFooter section
            // (at the end of the report).
            gr.Modifier  = BrickModifier.ReportFooter;
            gr.BackColor = SystemColors.ControlDark;
            gr.Font      = new Font("Arial", 10, FontStyle.Bold);
            h            = gr.Font.Height;
            gr.DrawString(String.Format("{0:0.##}", count), Color.White,
                          new RectangleF(0, 0, X, h), BorderSide.All);
            gr.DrawString(String.Format("{0:0.##}", sum), Color.White,
                          new RectangleF(X, 0, X, h), BorderSide.All);

            // Display summaries for the current page items.
            gr.Modifier     = BrickModifier.MarginalFooter;
            gr.StringFormat = gr.StringFormat.ChangeAlignment(StringAlignment.Far);
            for (int i = 0; i < 2; i++)
            {
                sbriks[i] = gr.DrawString("", Color.Black,
                                          new RectangleF(i * X, 0, X, h), BorderSide.All);
            }

            ps.End();
        }