RITU goel

RITU goel

  • NA
  • 23
  • 440

WPF app for pattern generated by intersecting circles

Apr 26 2018 12:29 AM
Hi,
 
I am making a C# based windows application in Visual studio 2017.
 
I am using below code to take center of circles from a file and plotting them with increasing radius. Also, I need to remove the intersection part of all circles.
 
Please suggest if I can do all the calculations in paint event or I used only only call paint event from other methods.
  1. protected override void OnPaint(PaintEventArgs e)  
  2. {  
  3. e.Graphics.TranslateTransform(this.ClientRectangle.Width / 3, this.ClientRectangle.Height / 3);  
  4. Pen linePen = new Pen(System.Drawing.Color.CornflowerBlue);  
  5. Int32 Num_of_Lines;  
  6. Int32 gridLength;  
  7. Int32 gridWidth;  
  8. Int32 Size_of_circle;  
  9. while (r < 300)  
  10. {  
  11. for (theta1 = 0; theta1 <= 360; theta1 = theta1 + .360F)  
  12. {  
  13. foreach (PointF point in this.circleCoordinates)  
  14. {  
  15. Pen redPen1 = new Pen(Color.Red, 100);  
  16. e.Graphics.DrawArc(Pens.Red, point.X, point.Y, r, r, theta1, theta1 + .360F);  
  17. }  
  18. }  
  19. e.Graphics.Clear(blue);  
  20. r = r + 25;  
  21. }  
  22. foreach (PointF point in this.circleCoordinates)  
  23. {  
  24. Pen redPen1 = new Pen(Color.Red, 100);  
  25. e.Graphics.DrawArc(Pens.Red, point.X, point.Y, 200, 200, 0, 360F);  
  26. }  
  27. linePen.Dispose();  
  28. base.OnPaint(e);  
  29. }  
Please suggest solution for this, Also, give your mail id, so that I can ask my question there.