protected override void CreateDetail(BrickGraphics graph) { if (Image != null) { // Add an image to a specific location. graph.DrawImage(Image, new Rectangle(0, 0, Image.Width, Image.Height), BorderSide.None, Color.Transparent); if (AddPageBreak) { // Add a page break after the image. graph.PrintingSystem.InsertPageBreak(Image.Height + 1); } } }
private void Link_CreateDetailArea(object sender, CreateAreaEventArgs e) { int y = 0; BrickGraphics brickGraphics = e.Graph; barCodeControl1.Text = printHw; barCodeControl1.DrawToBitmap(bitmap, barCodeControl1.ClientRectangle); brickGraphics.DrawImage(bitmap, barCodeControl1.ClientRectangle, BorderSide.None, Color.Transparent); y += barCodeControl1.Height; TextBrick textBrick = brickGraphics.DrawString(printDisplayHw, 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); }
protected override void CreateRow(BrickGraphics graph) { base.CreateRow(graph); // Add an empty rectangle with all borders // to a specific location using a Lavender background color. graph.DrawRect(new Rectangle(200, top, 50, 50), BorderSide.All, bkImageColor, graph.BorderColor); if (img != null) { // Add an image without borders // to a specific location using a Transparent color. graph.DrawImage(img, new Rectangle(200 + (50 - img.Width) / 2, top + (50 - img.Height) / 2, img.Width, img.Height), BorderSide.None, Color.Transparent); } }
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(); }
private void btn_DrawImage_Click(object sender, EventArgs e) { VisualBrick visBrick; Image img = imageList1.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(96, 96)); // Specify a page area. brickGraph.Modifier = BrickModifier.Detail; // Add an image brick to the report. visBrick = brickGraph.DrawImage(img, rect, BorderSide.All, Color.White); // Finish the report generation. printingSystem1.End(); // Preview the report. printingSystem1.PreviewFormEx.Show(); }
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(); }
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(); }
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(); }