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(); }
protected override void PutStateToBrick(VisualBrick brick, PrintingSystemBase ps) { if (this.LineStyle != System.Drawing.Drawing2D.DashStyle.Custom) { base.PutStateToBrick(brick, ps); } else { PanelBrick panel = (PanelBrick)brick; panel.BackColor = Color.Transparent; panel.Sides = BorderSide.None; int i; if (this.LineDirection == LineDirection.Horizontal) { for (i = 0; i < Convert.ToInt32(panel.Rect.Width / (this.Dash + this.Space)); i++) { LineBrick dashBrick = new LineBrick(); dashBrick.Sides = BorderSide.None; dashBrick.BackColor = panel.Style.ForeColor; dashBrick.Rect = new RectangleF(i * (this.Dash + this.Space), panel.Rect.Height / 2 - this.LineWidth / 2, this.dash, this.LineWidth); panel.Bricks.Add(dashBrick); } LineBrick endBrick = new LineBrick(); endBrick.Sides = BorderSide.None; endBrick.BackColor = panel.Style.ForeColor; endBrick.Rect = new RectangleF(i * (this.Dash + this.Space), panel.Rect.Height / 2 - this.LineWidth / 2, panel.Rect.Width - i * (this.Dash + this.Space), this.LineWidth); panel.Bricks.Add(endBrick); } else if (this.LineDirection == LineDirection.Vertical) { for (i = 0; i < Convert.ToInt32(panel.Rect.Height / (this.Dash + this.Space)); i++) { LineBrick dashBrick = new LineBrick(); dashBrick.Sides = BorderSide.None; dashBrick.BackColor = panel.Style.ForeColor; dashBrick.Rect = new RectangleF(panel.Rect.Width / 2 - this.LineWidth / 2, i * (this.Dash + this.Space), this.LineWidth, this.Dash); panel.Bricks.Add(dashBrick); } LineBrick endBrick = new LineBrick(); endBrick.Sides = BorderSide.None; endBrick.BackColor = panel.Style.ForeColor; endBrick.Rect = new RectangleF(panel.Rect.Width / 2 - this.LineWidth / 2, i * (this.Dash + this.Space), this.LineWidth, panel.Rect.Height - i * (this.Dash + this.Space)); panel.Bricks.Add(endBrick); } } }
private void btnDrawLine_Click(object sender, EventArgs e) { // Prepare for creating a document. ps.Begin(); BrickGraphics gr = ps.Graph; gr.Modifier = BrickModifier.Detail; // Draw a line with the specified coordinates, foreground color and thickness. LineBrick brick = gr.DrawLine(new PointF(0, 0), new PointF(200, 200), Color.Red, 5); // Change the line style to dash-dot-dot. brick.LineStyle = System.Drawing.Drawing2D.DashStyle.DashDotDot; // Hide brick borders. brick.BorderWidth = 0; // Finish creating the document. ps.End(); }