private void btn_NonPrintableBrick_Click(object sender, EventArgs e) { BrickGraphics graph = printingSystem1.Graph; // Start the report generation. printingSystem1.Begin(); // Set the modifier - specify the page area. graph.Modifier = BrickModifier.MarginalHeader; string format = "Page {0} of {1}"; graph.Font = graph.DefaultFont; graph.BackColor = Color.Transparent; RectangleF r = new RectangleF(0, 0, 0, graph.Font.Height); // Create a brick. PageInfoBrick brick = graph.DrawPageInfo(PageInfo.NumberOfTotal, format, Color.Black, r, BorderSide.None); brick.Alignment = BrickAlignment.Far; brick.AutoWidth = true; // Create another brick with different alignment. brick = graph.DrawPageInfo(PageInfo.DateTime, "{0:MMMM dd}", Color.Black, r, BorderSide.None); // Change the page area - set the modifier. printingSystem1.Graph.Modifier = BrickModifier.DetailHeader; graph.BackColor = Color.Silver; // Create a brick, which will be hidden in the printout. TextBrick tBrick = new TextBrick(BorderSide.None, 1, Color.Black, Color.Khaki, Color.Blue); tBrick.Url = "http://www.devexpress.com"; tBrick.Text = "Click here to visit our web site"; tBrick.CanPublish = false; printingSystem1.Graph.DrawBrick(tBrick, new RectangleF(0, 0, 200, 20)); // Create a brick - a column header. printingSystem1.Graph.DrawString("Report Items", Color.Black, new RectangleF(0, 20, 200, 20), BorderSide.All); // Change the page area - set the modifier. printingSystem1.Graph.Modifier = BrickModifier.Detail; graph.BackColor = Color.White; // Create bricks. for (int i = 0; i < 100; i++) { printingSystem1.Graph.DrawString("Item N" + Convert.ToString(i + 1), Color.Black, new RectangleF(0, 20 * i, 200, 20), BorderSide.All); } // Finish the report generation. printingSystem1.End(); // Preview the report. printingSystem1.PreviewFormEx.Show(); }
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(); }
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(); }
private void btn_DrawPageInfo_Click(object sender, EventArgs e) { PageInfoBrick pinfoBrick; BrickGraphics brickGraph = printingSystem1.Graph; // Start the report generation. printingSystem1.Begin(); // Create a rectangle. RectangleF rect = new RectangleF(new PointF(0, 0), new SizeF(250, 20)); // Specify the page header. brickGraph.Modifier = BrickModifier.MarginalHeader; // Create page info brick to display time in full format. pinfoBrick = brickGraph.DrawPageInfo(PageInfo.DateTime, "{0:F}", Color.Black, rect, BorderSide.None); // Specify the page footer. brickGraph.Modifier = BrickModifier.MarginalFooter; // Create a page info brick to display page number. pinfoBrick = brickGraph.DrawPageInfo(PageInfo.NumberOfTotal, "Page {0} of {1}", Color.Black, rect, BorderSide.None); // Finish the report generation. printingSystem1.End(); // Preview the report. printingSystem1.PreviewFormEx.Show(); }
protected override void CreateMarginalHeader(BrickGraphics graph) { // Set the format string for a page info brick. string format = "Page {0} of {1}"; // Set font to the default font. graph.Font = graph.DefaultFont; // Set the background color to Transparent. graph.BackColor = Color.Transparent; // Set the rectangle for drawing. RectangleF r = new RectangleF(0, 0, 0, graph.Font.Height); // Add a page info brick without borders that displays // the current page number from the total number of pages. PageInfoBrick brick = graph.DrawPageInfo(PageInfo.NumberOfTotal, format, Color.Black, r, BorderSide.None); // Set brick alignment. brick.Alignment = BrickAlignment.Far; // Enable auto width for a brick. brick.AutoWidth = true; // Add a page info brick without borders // that displays date and time. brick = graph.DrawPageInfo(PageInfo.DateTime, "", Color.Black, r, BorderSide.None); // Set brick alignment. brick.Alignment = BrickAlignment.Near; // Enable auto width for a brick. brick.AutoWidth = true; }
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 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(); }
public bool DrawDataGrid(BrickGraphics g) { bool bContinue = false; try { //DrawHeader(g); if (sClass) { bContinue = DrawClass(g); } else { bContinue = DrawRows(g); } if (!boolContinue) { InitializeData(); } return(bContinue); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); return(false); } }
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(); }
public override void CreateArea(BrickGraphics graph, RectangleF rectBorder, bool Three3D) { PointF pt1 = rectBorder.Location; PointF pt2 = new PointF(rectBorder.X + rectBorder.Width, rectBorder.Y + rectBorder.Height); Brush brush; if (this.FillStyle == FillStyle.Hatch) { brush = new HatchBrush(this.HatchStyle, this.BorderColor, this.FillColor); } else if (this.FillStyle == FillStyle.Solid) { brush = new SolidBrush(this.FillColor); } else if (this.FillStyle == FillStyle.Picture && this.FillImage != null) { brush = new TextureBrush(this.FillImage); } else { brush = new SolidBrush(Color.Transparent); } graph.DrawShape(this.pen, 2, pt1, pt2, this.BorderColor, this.FillColor, this.BorderWidth, brush, Three3D); }
private void btnDrawBrick_Click(object sender, EventArgs e) { // Prepare for creating a document. ps.Begin(); BrickGraphics gr = ps.Graph; gr.Modifier = BrickModifier.Detail; // Create a new line brick. LineBrick brick = new LineBrick(); // Specify its properties. brick.Rect = new RectangleF(0, 0, 200, 200); brick.LineDirection = DevExpress.XtraReports.UI.LineDirection.BackSlant; brick.ForeColor = Color.Red; brick.LineWidth = 5; brick.LineStyle = System.Drawing.Drawing2D.DashStyle.DashDotDot; brick.BorderWidth = 0; // Draw this brick. gr.DrawBrick(brick); // Finish creating the document. ps.End(); }
public override void CreateArea(BrickGraphics graph, RectangleF rectBorder, bool Three3D) { Pen drawpen = this.ArrowPen(); PointF[] points = this.DrawPoints(rectBorder); graph.DrawShape(drawpen, 0, points[0], points[1], this.BorderColor, this.BorderColor, this.BorderWidth, Brushes.Black, Three3D); }
private void button1_Click(object sender, EventArgs e) { // Obtain the PrintingSystem's graphics. BrickGraphics gr = printingSystem1.Graph; // Load an image from a file. Image img = Image.FromFile(@"..\..\Fish.png"); // Create an ImageBrick and specify its properties. ImageBrick ibrk = new ImageBrick(); ibrk.Image = img; ibrk.Sides = BorderSide.All; ibrk.BorderColor = Color.Blue; ibrk.BorderWidth = 10; // Start report generation. printingSystem1.Begin(); // Add the ImageBrick to the Detail section of the report. RectangleF r = new RectangleF(new PointF(0, 0), new SizeF(256, 160)); gr.Modifier = BrickModifier.Detail; gr.DrawBrick(ibrk, r); // Finish report generation. printingSystem1.End(); // Display the Print Preview form. printingSystem1.PreviewFormEx.Show(); }
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(); }
//测量字符的打印范围(多行) private SizeF MeasureString(string text, Font font, int width) { SizeF size = BrickGraphics.MeasureString(text, font, width, null, GraphicsUnit.Pixel); size.Width = size.Width; size.Height = size.Height; return(size); }
protected override void CreateDetail(BrickGraphics graph) { // Center the text string. graph.StringFormat = graph.StringFormat.ChangeLineAlignment(StringAlignment.Center); base.CreateDetail(graph); CreateRow(graph); }
protected override void CreateRow(BrickGraphics graph) { base.CreateRow(graph); // Add a checked check box brick with all borders // to a specific location using the Light Sky Blue background color. graph.DrawCheckBox(new Rectangle(150, top, 50, 50), BorderSide.All, Color.LightSkyBlue, true); }
private void button1_Click(object sender, EventArgs e) { BrickGraphics graph = printingSystem1.Graph; // Start the report generation. printingSystem1.Begin(); // Set the modifier - specify the page area. graph.Modifier = BrickModifier.MarginalHeader; string format = "Page {0} of {1}"; graph.Font = graph.DefaultFont; graph.BackColor = Color.Transparent; RectangleF r = new RectangleF(0, 0, 0, graph.Font.Height); // Create a brick. PageInfoBrick brick = graph.DrawPageInfo(PageInfo.NumberOfTotal, format, Color.Black, r, BorderSide.None); brick.Alignment = BrickAlignment.Far; brick.AutoWidth = true; // Create another brick with different alignment. brick = graph.DrawPageInfo(PageInfo.DateTime, "{0:MMMM dd}", Color.Black, r, BorderSide.None); // Change the page area - set the modifier. printingSystem1.Graph.Modifier = BrickModifier.DetailHeader; graph.BackColor = Color.Silver; // Create a brick. printingSystem1.Graph.DrawString("Report Items", Color.Black, new RectangleF(0, 0, 200, 20), BorderSide.All); // Change the page area - set the modifier. printingSystem1.Graph.Modifier = BrickModifier.Detail; graph.BackColor = Color.White; // Create bricks. for (int i = 0; i < 100; i++) { printingSystem1.Graph.DrawString("Item N" + Convert.ToString(i + 1), Color.Black, new RectangleF(0, 20 * i, 200, 20), BorderSide.All); } printingSystem1.End(); printingSystem1.PreviewFormEx.Show(); }
protected override void CreateMarginalHeader(BrickGraphics gr) { gr.Modifier = BrickModifier.MarginalHeader; string format = "Printed on {0:MMMM, dd}"; PageInfoBrick brick = gr.DrawPageInfo(PageInfo.DateTime, format, Color.Black, new RectangleF(0, 0, 0, 20), BorderSide.None); brick.Alignment = BrickAlignment.Far; brick.AutoWidth = true; }
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); }
protected override void CreateMarginalFooter(BrickGraphics gr) { gr.Modifier = BrickModifier.MarginalFooter; string format = "Page {0} of {1}"; PageInfoBrick brick = gr.DrawPageInfo(PageInfo.NumberOfTotal, format, Color.Black, new RectangleF(0, 0, 0, 20), BorderSide.None); brick.Alignment = BrickAlignment.Far; brick.AutoWidth = true; }
private static void Link_CreateMarginalHeaderArea(object sender, CreateAreaEventArgs e) { BrickGraphics brickGraphics = e.Graph; brickGraphics.BackColor = Color.White; brickGraphics.Font = new Font("Tahoma", 11, FontStyle.Bold); //Declare text strings. string devexpress = "XtraPrintingSystem by Developer Express Inc."; }
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); }
// 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); }
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); }
void CreatePageHeader(BrickGraphics gr) { Brick[] bricks = new Brick[] {CreateBrick(KontoGlobals.ComputerName, PageInfo.None), CreateBrick(KontoGlobals.ComputerName, PageInfo.None)}; gr.Font = _ps.Graph.DefaultFont; PageTableBrick table = CreateTable(bricks); table.LineAlignment = BrickAlignment.Far; gr.DrawBrick(table); }
protected override void CreateDetail(BrickGraphics graph) { base.CreateDetail(graph); bool more = DrawDataGrid(graph); if (more == true) { //e.HasMorePages = true; PageNumber++; } }
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); }
public void CreateArea(BrickGraphics graph, RectangleF rectBorder, bool Three3D) { try { _ShapeEx.CreateArea(graph, rectBorder, Three3D); } catch (Exception E) { MessageBox.Show("Can't Create Shapes's Area!"); throw E; } }
void DrawVerticalGridLines(BrickGraphics g, Pen TheLinePen, int columnwidth, int bottom) { //if (TheDataGrid.GridLineStyle == DataGridLineStyle.None) // return; //for (int k = 0; k < TheTable.Columns.Count; k++) //{ // g.DrawLine(TheLinePen, TheDataGrid.Location.X + k*columnwidth, // TheDataGrid.Location.Y + TopMargin, // TheDataGrid.Location.X + k*columnwidth, // bottom); //} }
protected virtual void CreateRow(BrickGraphics g) { bool bContinue = false; try { //DrawHeader(g); if (sClass) { bContinue = DrawClass(g); } else { bContinue = DrawRows(g); // if (!bContinue) InitializeData(); bContinue = DrawClass(g); } // DrawHorizontalLines(g, 10); // g.DrawString("Test Printing",Color.Black,new RectangleF(10,20,200,100), BorderSide.None); if (!bContinue) InitializeData(); // System.Console.WriteLine("Test"); //return bContinue; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); //return false; } //if (bContinue) //{ // PageNumber++; // // sClass = false; // //mainFrm.DrawTopLabel(newBrick); // sClass = true; // return CreateRow(g); //} //else //{ // return bContinue; //} }
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); }
protected override void CreateDetail(BrickGraphics g) { base.CreateDetail(g); CreateRow(g); }
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 CreateDetail(BrickGraphics graph) { base.CreateDetail(graph); Single extendedHeight; Single y; y = 0; extendedHeight = 0; bool scanForChildControls; if (DelegatePrintingReportTitle != null) { _MultiPage.NewPage(graph); DelegatePrintingReportTitle(_f, ParentControlPrinting.BeforeChilds, _MultiPage, _xform, y, ref extendedHeight, out scanForChildControls); //y += extendedHeight; } //else // y += newExtendedHeight; // Print each control on the form Single globalExtendedHeight; _xform = 1; PrintControls(_f, _MultiPage, _xform, y, out globalExtendedHeight); if (_MultiPage.LastPage()) { //ev.HasMorePages = false; _MultiPage.ResetPage(); } }
public void DrawString(string s, Font printFont, Color brush, Single x, Single y, Single w, Single h, BrickGraphics _G) { DrawString(s, printFont, brush, x, y, w, h, new StringFormat(),_G); }
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 CreateDetail(BrickGraphics graph) { graph.DrawString(caption, Color.Black, r, BorderSide.None); }
public bool DrawRows(BrickGraphics g) { int lastRowBottom = TopMargin; try { //SolidBrush ForeBrush = new SolidBrush(System.Drawing.Color.Black); Color ForeBrush = System.Drawing.Color.Black; Color BackBrush = 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; BrickStringFormat brickCellFormat = new BrickStringFormat(cellformat); 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))); // int X = 10; bool IsRichText = false; //bool LastIsRichText = false; if (LastPos <= 0) { 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) { this.DrawString(arrLabel[i].ToString() + " : ", _font_label, Color.Black, 50, X, TextWidth, TextHeight,new StringFormat(), g); //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++; } this.DrawString(arrValue[i].ToString(), _font_value, Color.Black, 50, X, TextWidth, TextHeight, new StringFormat(), g); //g.DrawString(arrValue[i].ToString(), _font_value, new SolidBrush(System.Drawing.Color.Black), 50, X, new StringFormat()); X += CarriageReturnCnt * 11; IsRichText = false; } else { this.DrawString(arrLabel[i].ToString() + " : ", _font_label, Color.Black, 50, X, TextWidth, TextHeight, new StringFormat(), g); //g.DrawString(arrLabel[i].ToString() + " : ", _font_label, new SolidBrush(System.Drawing.Color.Black), 50, X, new StringFormat()); this.DrawString(arrValue[i].ToString(), _font_value, Color.Black, 210, X, TextWidth, TextHeight, new StringFormat(), g); //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; } } if (arrValue1 != null) { if (((LastPos == 1) && (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; this.DrawString("Initial Test Event >>",_font_label,Color.Black,50,X,TextWidth,TextHeight,new StringFormat(), g); //g.DrawString("Initial Test Event >>", _font_label, new SolidBrush(System.Drawing.Color.Black), 50, X, new StringFormat()); X += 10; } else { this.DrawString(arrLabel1[i].ToString(), _font_label, Color.Black, 50, X, TextWidth, TextHeight, new StringFormat(), g); //g.DrawString(arrLabel1[i].ToString() + " : ", _font_label, new SolidBrush(System.Drawing.Color.Black), 50, X, new StringFormat()); this.DrawString(arrValue1[i].ToString(), _font_value, Color.Black, 210, X, TextWidth, TextHeight, new StringFormat(), g); //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; } } else LastPos = 2; } if (arrValue2 != 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; this.DrawString("MidTerm Test Event >>", _font_label, Color.Black, 50, X, TextWidth, TextHeight, new StringFormat(), g); //g.DrawString("MidTerm Test Event >>", _font_label, new SolidBrush(System.Drawing.Color.Black), 50, X, new StringFormat()); X += 10; } else { this.DrawString(arrLabel1[i].ToString() + " : ", _font_label, Color.Black, 50, X, TextWidth, TextHeight, new StringFormat(), g); //g.DrawString(arrLabel1[i].ToString() + " : ", _font_label, new SolidBrush(System.Drawing.Color.Black), 50, X, new StringFormat()); this.DrawString(arrValue2[i].ToString(), _font_value, Color.Black, 210, X, TextWidth, TextHeight, new StringFormat(), g); //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; } if (arrValue3 != 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; this.DrawString("Final Test Event >>", _font_label, Color.Black, 50, X, TextWidth, TextHeight, new StringFormat(), g); //g.DrawString("Final Test Event >>", _font_label, new SolidBrush(System.Drawing.Color.Black), 50, X, new StringFormat()); X += 10; } else { this.DrawString(arrLabel1[i].ToString() + " : ", _font_label, Color.Black, 50, X, TextWidth, TextHeight, new StringFormat(), g); //g.DrawString(arrLabel1[i].ToString() + " : ", _font_label, new SolidBrush(System.Drawing.Color.Black), 50, X, new StringFormat()); this.DrawString(arrValue3[i].ToString(), _font_value, Color.Black, 210, X, TextWidth, TextHeight, new StringFormat(), g); //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; } } } } } return false; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); return false; } }
public bool DrawDataGrid(BrickGraphics g,frmClassDlg mainFrm) { bool bContinue=false; try { //DrawHeader(g); if(sClass) { bContinue = DrawClass(g); } else { bContinue = DrawRows(g); } if(!boolContinue) InitializeData(); if (bContinue) { PageNumber++; //sClass = false; BrickGraphics newBrick = (BrickGraphics)g.PrintingSystem.CreateBrick("Brick"); //g.PrintingSystem.Document.Pages.Add((Page)p); mainFrm.DrawTopLabel(newBrick); // sClass = true; return DrawDataGrid(newBrick, mainFrm); } else { return bContinue; } //return bContinue; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); return false; } }
void DrawHorizontalLines(BrickGraphics g, float y) { Pen TheLinePen = new Pen(System.Drawing.Color.Gray, 1); //if (TheDataGrid.GridLineStyle == DataGridLineStyle.None) // return; //for (int i = 0; i < lines.Count; i++) //{ g.DrawLine(new PointF(20,y),new PointF(PageWidth-40, y),Color.Gray,1); //} }
//protected override void CreateInnerPageHeader(BrickGraphics graph) //{ // base.CreateInnerPageHeader(graph); // int TopMargin = ps.PageSettings.Margins.Top; // Font _font = // new System.Drawing.Font("Arial", 13F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); // //g.DrawString("Class Information", _font, new SolidBrush(label1.ForeColor), 20, 40, new StringFormat()); // this.DrawString("Class Information", _font, Label1ForeColor, 20, 40, TextWidth, TextHeight, new StringFormat(), graph); // //Graphics g = e.Graphics; // //DrawTopLabel(g); // //bool more = nm.DrawDataGrid(g); // //if (more == true) // //{ // // e.HasMorePages = true; // // nm.PageNumber++; // //} //} protected override void CreateMarginalHeader(BrickGraphics graph) { base.CreateMarginalHeader(graph); int TopMargin = ps.PageSettings.Margins.Top; Font _font = new System.Drawing.Font("Arial", 13F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); //g.DrawString("Class Information", _font, new SolidBrush(label1.ForeColor), 20, 40, new StringFormat()); graph.Font = _font; SizeF size = graph.MeasureString(RTitle); int x = PageWidth / 2; x = x - Convert.ToInt32(size.Width / 2); this.DrawString(RTitle, _font, Label1ForeColor, x, 10, TextWidth, TextHeight, new StringFormat(), graph); }
public bool DrawDataGrid(BrickGraphics g) { bool bContinue = false; try { //DrawHeader(g); if (sClass) { bContinue = DrawClass(g); } else { bContinue = DrawRows(g); } if (!boolContinue) InitializeData(); return bContinue; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); return false; } }
protected override void CreateMarginalFooter(BrickGraphics graph) { base.CreateMarginalFooter(graph); if (_MultiPage._pageNumbering) { //graph.DrawBrick() PageInfoBrick info = new PageInfoBrick(BorderSide.None, 0, Color.White, Color.White, Color.Black); info.Alignment = BrickAlignment.Far; info.Font = _MultiPage._FontForPageNumering; info.Format = "Page {0}"; info.PageInfo = PageInfo.Number; info.Printed = true; info.LineAlignment = BrickAlignment.Near; graph.DrawBrick(info); } }
protected override void CreateMarginalHeader(BrickGraphics graph) { base.CreateMarginalHeader(graph); _MultiPage.NewPage(graph); Single extendedHeight; Single y; y = 0; extendedHeight = 0; bool scanForChildControls; if (DelegatePrintingReportTitle == null) PrintReportTitle(_f, ParentControlPrinting.BeforeChilds, _MultiPage, _xform, y, ref extendedHeight, out scanForChildControls); y += extendedHeight; newExtendedHeight = y; }
/// <summary> /// Change page. Reset page properties /// </summary> /// <param name="g">Graphics object</param> public void NewPage(BrickGraphics g) { _G = g; _PageNumber += 1; _UsablePageHeight = _realPageHeight; if (_pageNumbering) { Single fontHeightForPageNumbering = FontHeight(_FontForPageNumering); //_UsablePageHeight -= (Single)(fontHeightForPageNumbering * 1.5); // Compute rectangular space for page number RectangleF _recForPageNumbering = new RectangleF(); _recForPageNumbering.X = _realPageLeft; _recForPageNumbering.Y = _realPageTop + _realPageHeight - fontHeightForPageNumbering; _recForPageNumbering.Width = _realPageRight - _realPageLeft; _recForPageNumbering.Height = fontHeightForPageNumbering; // impression StringFormat drawFormat = new StringFormat(); drawFormat.Alignment = StringAlignment.Far; _G.Font = _FontForPageNumering; _G.ForeColor = Color.Black; BrickStringFormat xformat = new BrickStringFormat(drawFormat); _G.StringFormat = xformat; //_G.DrawString(String.Format(_PageNumberingFormat, _PageNumber), Color.Black, _recForPageNumbering, BorderSide.None); //_G.DrawString(String.Format(_PageNumberingFormat, _PageNumber), _FontForPageNumering, Brushes.Black, _recForPageNumbering, drawFormat); } _CurrentPageTop = _UsablePageHeight * (_PageNumber - 1); _CurrentPageBottom = _CurrentPageTop + _UsablePageHeight; _PageOverflow = false; }