Note that there are some explanatory texts on larger screens.

plurals
  1. POC# GraphicsPath drawing issues
    primarykey
    data
    text
    <p>I am trying to draw a GraphicsPath in my program, but it seems to have issues where it adds random spikes to the path. This seems to get worse the wider the path is. I have made some test code which can replicate this problem.</p> <p>This code required a form with a PictureBox in it (PictureBox dimensions at least 630 x 1050), and a single button. The code is then as follows:</p> <pre><code> private void button1_Click(object sender, EventArgs e) { drawSomeLines(); pictureBox1.Refresh(); } private void drawSomeLines() { //initialise the plot area: Bitmap image = new Bitmap(pictureBox1.Width, pictureBox1.Height); pictureBox1.BackgroundImage = image; Graphics g = Graphics.FromImage(image); //create a graphics path: GraphicsPath gPath = new GraphicsPath(); //add sections to the path: gPath.AddLine(587.310059F, 29.2261658F, 229.974731F, 668.2402F); gPath.AddArc(new RectangleF(203.177338F,560.3876F,421.357F,421.357F), -(90 - 299.21382700000413F), -1.532426F); gPath.AddArc(new RectangleF(203.177368F,560.3876F,421.357F,421.357F), -(90 - 297.72672132554612F), -1.53240252F); gPath.AddLine(224.740067F,678.2186F, 76.6899643F,979.773865F); //draw the path 3 times, at different widths: g.DrawPath(new Pen(new SolidBrush(Color.FromArgb(100, Color.Blue)), 80), gPath); g.DrawPath(new Pen(new SolidBrush(Color.Blue), 40), gPath); g.DrawPath(new Pen(new SolidBrush(Color.Red), 2), gPath); } </code></pre> <p>I have drawn the path here 3 times at different widths, which shows how the problem gets worse at larger widths.</p> <p>Does anyone know why this happens, and how I might prevent it? Any ideas would be much appreciated.</p> <p>Cheers,</p> <p>Greg</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload