private void btn_DrawPageImage_Click(object sender, EventArgs e) { PageImageBrick pimBrick; Image img = imageList2.Images[0]; BrickGraphics brickGraph = printingSystem1.Graph; // Start the report generation. printingSystem1.Begin(); // Create a rectangle. RectangleF rect = new RectangleF(new PointF(0, 0), new SizeF(179, 34)); // Specify a marginal page header area. brickGraph.Modifier = BrickModifier.MarginalHeader; // Create a page image brick. pimBrick = brickGraph.DrawPageImage(img, rect, BorderSide.None, Color.White); // Specify a Detail area. brickGraph.Modifier = BrickModifier.Detail; // Finish the report generation. printingSystem1.End(); // Preview the report. printingSystem1.PreviewFormEx.Show(); }
private void Link_CreateMarginalHeaderArea(object sender, CreateAreaEventArgs e) { // Specify required settings for the brick graphics. BrickGraphics brickGraphics = e.Graph; brickGraphics.BackColor = Color.White; brickGraphics.Font = new Font("Arial", 8); // Declare bricks. PageInfoBrick pageInfoBrick; PageImageBrick pageImageBrick; // Declare text strings. string devexpress = "XtraPrintingSystem by Developer Express Inc."; // Define the image to display. //Image pageImage = Image.FromFile(@"..\..\logo.png"); Image pageImage = new Bitmap(1, 1);//= Properties.Resources.excel32; // Display the DevExpress text string. SizeF size = brickGraphics.MeasureString(devexpress); pageInfoBrick = brickGraphics.DrawPageInfo(PageInfo.None, devexpress, Color.Black, new RectangleF(new PointF(/*343 -*/ 100 - (size.Width - pageImage.Width) / 2, pageImage.Height + 3), size), BorderSide.None); pageInfoBrick.Alignment = BrickAlignment.Center; // Display the PageImageBrick containing the DevExpress logo. pageImageBrick = brickGraphics.DrawPageImage(pageImage, new RectangleF(1, 0, pageImage.Width, pageImage.Height), BorderSide.None, Color.Transparent); //pageImageBrick.Alignment = BrickAlignment.Center; // Set the rectangle for a page info brick. RectangleF r = RectangleF.Empty; r.Height = 20; // Display the PageInfoBrick containing date-time information. Date-time information is displayed // in the left part of the MarginalHeader section using the FullDateTimePattern. pageInfoBrick = brickGraphics.DrawPageInfo(PageInfo.DateTime, "{0:F}", Color.Black, r, BorderSide.None); pageInfoBrick.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. pageInfoBrick = brickGraphics.DrawPageInfo(PageInfo.NumberOfTotal, "Page {0} of {1}", Color.Black, r, BorderSide.None); pageInfoBrick.Alignment = BrickAlignment.Far; }
private void PrintableComponentLink_CreateReportHeaderArea(object sender, DevExpress.XtraPrinting.CreateAreaEventArgs e) { // Specify required settings for the brick graphics. BrickGraphics brickGraphics = e.Graph; brickGraphics.BackColor = Color.White; brickGraphics.Font = new Font("Times New Roman", 8); // Declare bricks. PageInfoBrick pageInfoBrick; PageImageBrick pageImageBrick; // Define the image to display. Image pageImage = TaxesSystem.Properties.Resources.logo_option2; // Display the PageImageBrick containing the DevExpress logo. pageImageBrick = brickGraphics.DrawPageImage(pageImage, new Rectangle(856, 0, 100, 120), BorderSide.None, Color.Transparent); pageImageBrick.Alignment = BrickAlignment.Far; // Display the PageInfoBrick containing date-time information. Date-time information is displayed // in the left part of the MarginalHeader section using the FullDateTimePattern. //{0:F} pageInfoBrick = brickGraphics.DrawPageInfo(PageInfo.DateTime, "{0:MM/dd/yyyy hh:mm tt}", Color.Black, new Rectangle(840, 130, 120, 50), BorderSide.None); pageInfoBrick.Alignment = BrickAlignment.Far; // Declare text strings. string devexpress = title; // Specify required settings for the brick graphics. BrickGraphics brickGraphics2 = e.Graph; brickGraphics2.BackColor = Color.White; brickGraphics2.Font = new Font("Times New Roman", 16, FontStyle.Bold); // Display the DevExpress text string. SizeF size = brickGraphics2.MeasureString(devexpress); pageInfoBrick = brickGraphics2.DrawPageInfo(PageInfo.None, devexpress, Color.Black, new RectangleF(new PointF(440, 50), size), BorderSide.None); pageInfoBrick.Alignment = BrickAlignment.Center; pageInfoBrick.HorzAlignment = DevExpress.Utils.HorzAlignment.Center; }
private void PrintableComponentLink_CreateReportHeaderArea(object sender, DevExpress.XtraPrinting.CreateAreaEventArgs e) { // Specify required settings for the brick graphics. BrickGraphics brickGraphics = e.Graph; Height = 100; brickGraphics.BackColor = Color.White; brickGraphics.Font = new Font("Neo Sans Arabic", 10); // Declare bricks. PageInfoBrick pageInfoBrickFrom; PageInfoBrick pageInfoBrickTo; PageInfoBrick pageInfoBrick; PageInfoBrick pageInfo; PageInfoBrick pageInfo1; PageImageBrick pageImageBrick; // Define the image to display. Image pageImage = TaxesSystem.Properties.Resources.logo_option2; // Display the PageImageBrick containing the DevExpress logo. pageImageBrick = brickGraphics.DrawPageImage(pageImage, new Rectangle(10, 0, 80, 100), BorderSide.None, Color.Transparent); pageImageBrick.Alignment = BrickAlignment.Far; // Display the PageInfoBrick containing date-time information. Date-time information is displayed // in the left part of the MarginalHeader section using the FullDateTimePattern. //{0:F} pageInfoBrickFrom = brickGraphics.DrawPageInfo(PageInfo.None, ":من", Color.Black, new Rectangle(180, 110, 60, 80), BorderSide.None); pageInfoBrickFrom.Font = new Font("Tahoma", 10, FontStyle.Bold); pageInfoBrickFrom = brickGraphics.DrawPageInfo(PageInfo.None, d.dateFrom, Color.Black, new Rectangle(40, 110, 140, 80), BorderSide.None); pageInfoBrickFrom.Alignment = BrickAlignment.Near; pageInfoBrickFrom.Font = new Font("Tahoma", 10, FontStyle.Bold); pageInfoBrickTo = brickGraphics.DrawPageInfo(PageInfo.None, ":الي", Color.Black, new Rectangle(180, 130, 60, 80), BorderSide.None); pageInfoBrickTo.Font = new Font("Tahoma", 10, FontStyle.Bold); pageInfoBrickTo = brickGraphics.DrawPageInfo(PageInfo.None, d.dateTo, Color.Black, new Rectangle(40, 130, 140, 80), BorderSide.None); pageInfoBrickTo.Alignment = BrickAlignment.Near; pageInfoBrickTo.Font = new Font("Tahoma", 10, FontStyle.Bold); BrickGraphics brickGraphics1 = e.Graph; pageInfo = brickGraphics1.DrawPageInfo(PageInfo.None, d.delegateName, Color.Black, new Rectangle(525, 110, 180, 70), BorderSide.None); pageInfo.Alignment = BrickAlignment.Near; pageInfo.Font = new Font("Tahoma", 10, FontStyle.Bold); BrickGraphics brickGraphics3 = e.Graph; pageInfo1 = brickGraphics3.DrawPageInfo(PageInfo.None, d.company, Color.Black, new Rectangle(528, 130, 180, 70), BorderSide.None); pageInfo1.Alignment = BrickAlignment.Near; pageInfo1.Font = new Font("Tahoma", 10, FontStyle.Bold); if (d.company_profit_list != null) { pageInfoBrickTo = brickGraphics.DrawPageInfo(PageInfo.None, "الشركة", Color.Black, new Rectangle(525, 110, 100, 80), BorderSide.None); pageInfoBrickTo.Font = new Font("Tahoma", 10, FontStyle.Bold); pageInfoBrickTo = brickGraphics.DrawPageInfo(PageInfo.None, "قيمة ربح المندوب", Color.Black, new Rectangle(528, 130, 150, 80), BorderSide.None); pageInfoBrickTo.Alignment = BrickAlignment.Far; pageInfoBrickTo.Font = new Font("Tahoma", 10, FontStyle.Bold); int y = 130; PageInfoBrick pageInfoBrick3; foreach (company_profit item in d.company_profit_list) { y += 20; pageInfoBrick3 = brickGraphics.DrawPageInfo(PageInfo.None, item.companyName, Color.Black, new Rectangle(725, y, 140, 80), BorderSide.None); pageInfoBrick3.Font = new Font("Tahoma", 10, FontStyle.Regular); pageInfoBrick3 = brickGraphics.DrawPageInfo(PageInfo.None, item.delegateProfit, Color.Black, new Rectangle(528, y, 140, 80), BorderSide.None); pageInfoBrick3.Alignment = BrickAlignment.Far; pageInfoBrick3.Font = new Font("Tahoma", 10, FontStyle.Regular); } pageInfoBrick3 = brickGraphics.DrawPageInfo(PageInfo.None, d.delegateProfit + ":اجمالي ربح المندوب ", Color.Black, new Rectangle(685, y + 40, 230, 80), BorderSide.None); pageInfoBrick3.Alignment = BrickAlignment.Far; pageInfoBrick3.Font = new Font("Tahoma", 11, FontStyle.Bold); } // Declare text strings. string devexpress = title; // Specify required settings for the brick graphics. BrickGraphics brickGraphics2 = e.Graph; brickGraphics2.BackColor = Color.White; brickGraphics2.Font = new Font("Times New Roman", 14, FontStyle.Bold); // Display the DevExpress text string. SizeF size = brickGraphics2.MeasureString(devexpress); pageInfoBrick = brickGraphics2.DrawPageInfo(PageInfo.None, devexpress, Color.Black, new RectangleF(new PointF(320, 50), size), BorderSide.None); pageInfoBrick.Alignment = BrickAlignment.Center; if (branchName != "") { SizeF sizea = brickGraphics2.MeasureString(branchName); pageInfoBrick = brickGraphics2.DrawPageInfo(PageInfo.None, branchName, Color.Black, new RectangleF(new PointF(370, 70), size), BorderSide.None); pageInfoBrick.Alignment = BrickAlignment.Center; } e.Graph.PrintingSystem.Document.PrintingSystem.PageMargins.Bottom = 0; }
private void PrintableComponentLink_CreateReportHeaderArea(object sender, DevExpress.XtraPrinting.CreateAreaEventArgs e) { // Specify required settings for the brick graphics. BrickGraphics brickGraphics = e.Graph; brickGraphics.BackColor = Color.White; brickGraphics.Font = new Font("Neo Sans Arabic", 10); // Declare bricks. PageInfoBrick pageInfoBrickFrom; PageInfoBrick pageInfoBrickTo; PageInfoBrick pageInfoBrick; PageInfoBrick pageInfo; PageInfoBrick pageInfo1; PageImageBrick pageImageBrick; // Define the image to display. Image pageImage = TaxesSystem.Properties.Resources.logo_option2; // Display the PageImageBrick containing the DevExpress logo. pageImageBrick = brickGraphics.DrawPageImage(pageImage, new Rectangle(10, 0, 150, 150), BorderSide.None, Color.Transparent); pageImageBrick.Alignment = BrickAlignment.Far; // Display the PageInfoBrick containing date-time information. Date-time information is displayed // in the left part of the MarginalHeader section using the FullDateTimePattern. //{0:F} pageInfoBrickFrom = brickGraphics.DrawPageInfo(PageInfo.None, ":العميل", Color.Black, new Rectangle(180, 160, 60, 80), BorderSide.None); pageInfoBrickFrom.Font = new Font("Tahoma", 10, FontStyle.Bold); pageInfoBrickFrom = brickGraphics.DrawPageInfo(PageInfo.None, d.dateFrom, Color.Black, new Rectangle(40, 160, 120, 80), BorderSide.None); pageInfoBrickFrom.Alignment = BrickAlignment.Near; pageInfoBrickFrom.Font = new Font("Tahoma", 10, FontStyle.Bold); pageInfoBrickTo = brickGraphics.DrawPageInfo(PageInfo.None, ":تلفون العميل", Color.Black, new Rectangle(180, 180, 160, 80), BorderSide.None); pageInfoBrickTo.Font = new Font("Tahoma", 10, FontStyle.Bold); pageInfoBrickTo = brickGraphics.DrawPageInfo(PageInfo.None, d.dateTo, Color.Black, new Rectangle(40, 180, 120, 80), BorderSide.None); pageInfoBrickTo.Alignment = BrickAlignment.Far; pageInfoBrickTo.Font = new Font("Tahoma", 10, FontStyle.Bold); BrickGraphics brickGraphics1 = e.Graph; pageInfo = brickGraphics1.DrawPageInfo(PageInfo.None, d.dateFrom, Color.Black, new Rectangle(825, 160, 120, 70), BorderSide.None); pageInfo.Alignment = BrickAlignment.Near; pageInfo.Font = new Font("Tahoma", 10, FontStyle.Bold); BrickGraphics brickGraphics3 = e.Graph; pageInfo1 = brickGraphics3.DrawPageInfo(PageInfo.None, d.dateTo, Color.Black, new Rectangle(828, 180, 120, 70), BorderSide.None); pageInfo1.Alignment = BrickAlignment.Near; pageInfo1.Font = new Font("Tahoma", 10, FontStyle.Bold); pageInfoBrickTo = brickGraphics.DrawPageInfo(PageInfo.None, ":تاريخ الاسترجاع", Color.Black, new Rectangle(825, 240, 100, 80), BorderSide.None); pageInfoBrickTo.Font = new Font("Tahoma", 10, FontStyle.Bold); pageInfoBrickTo = brickGraphics.DrawPageInfo(PageInfo.None, ":سبب الاسترجاع", Color.Black, new Rectangle(628, 240, 150, 80), BorderSide.None); pageInfoBrickTo.Alignment = BrickAlignment.Far; pageInfoBrickTo.Font = new Font("Tahoma", 10, FontStyle.Bold); int y = 240; PageInfoBrick pageInfoBrick3; pageInfoBrick3 = brickGraphics.DrawPageInfo(PageInfo.None, d.delegateName, Color.Black, new Rectangle(825, y, 120, 80), BorderSide.None); pageInfoBrick3.Font = new Font("Tahoma", 10, FontStyle.Regular); pageInfoBrick3 = brickGraphics.DrawPageInfo(PageInfo.None, d.delegateProfit, Color.Black, new Rectangle(628, y, 150, 80), BorderSide.None); pageInfoBrick3.Alignment = BrickAlignment.Far; pageInfoBrick3.Font = new Font("Tahoma", 10, FontStyle.Regular); // Declare text strings. string devexpress = "أذن مرتجع"; // Specify required settings for the brick graphics. BrickGraphics brickGraphics2 = e.Graph; brickGraphics2.BackColor = Color.White; brickGraphics2.Font = new Font("Tahoma", 14, FontStyle.Bold); // Display the DevExpress text string. SizeF size = brickGraphics2.MeasureString(devexpress); pageInfoBrick = brickGraphics2.DrawPageInfo(PageInfo.None, devexpress, Color.Black, new RectangleF(new PointF(420, 50), size), BorderSide.None); pageInfoBrick.Alignment = BrickAlignment.Center; size = brickGraphics2.MeasureString(ReturnPermissionNum.ToString()); pageInfoBrick = brickGraphics2.DrawPageInfo(PageInfo.None, ReturnPermissionNum.ToString(), Color.Black, new RectangleF(new PointF(480, 80), size), BorderSide.None); pageInfoBrick.Alignment = BrickAlignment.Center; }
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(); }