In the top of the form i have:
PointF _pt = new PointF(0F, 0F); PointF _pt2 = new PointF(1F, 1F); PointF _pt3 = new PointF(2F, 2F); Color _lineColor = Color.FromArgb(0, 255, 0);
Then in the paint event:
private void pictureBox1_Paint(object sender, PaintEventArgs e) { anglecounter += 1; double x = pictureBox1.Size.Width / 2 + 256 *Math.Cos(anglecounter * Math.PI / 180); double y = pictureBox1.Size.Height / 2 +256 * Math.Sin(anglecounter * Math.PI / 180); CloudEnteringAlert.Paint(e.Graphics, factor, distance); e.Graphics.DrawLine( new Pen(Color.Red, 2f), new Point(pictureBox1.Size.Width / 2, pictureBox1.Size.Height/2), new Point((int)x, (int)y)); e.Graphics.DrawEllipse( new Pen(Color.Red, 2f), 0, 0, pictureBox1.Size.Width, pictureBox1.Size.Height); // create the fade path and gradient GraphicsPath gp = new GraphicsPath(FillMode.Winding); gp.AddLine(new PointF((float)(pictureBox1.Size.Width / 2), (float)(pictureBox1.Size.Height / 2)),new PointF( (float)x,(float)y)); gp.AddCurve(new PointF[] { _pt2, _pt3, _pt }); gp.AddLine(new PointF((float)x, (float)y), new PointF((float)(pictureBox1.Size.Width / 2), (float)(pictureBox1.Size.Height / 2))); PathGradientBrush pgb = new PathGradientBrush(gp); pgb.CenterPoint = new PointF((float)x, (float)y); pgb.CenterColor = Color.FromArgb(128, _lineColor); pgb.SurroundColors = new Color[] { Color.Empty }; // draw the fade path e.Graphics.FillPath(pgb, gp); }
The first part in the paint event is working.
I draw a circle in the pictureBox1. Then draw a line from the center of the circle to the edge of the circle and move the angle by 1. Since the paint event is called by a timer i had already then i see the line is moving like a radar for example.
Now i want to add to the line the effect of a radar when the line leave behind effect of trail or trace.
So i added the part of the GraphicsPath but i dont see anything of it its not drawing anything this part. I just keep see the curcle and the line moving.
Whats wrong ?