Guest User

Untitled

a guest
Jan 17th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. (double input=Convert.ToDouble(textBox1.Text)
  2.  
  3. {
  4. private void button1_Click(object sender, EventArgs e)
  5.  
  6. {
  7. double input....
  8. double radius= Math.PI*input*input;
  9. Graphics paper;
  10. paper = pictureBox1.CreateGraphics();
  11. Pen pen = new Pen(Color.Black);
  12. getCircle(paper, pen, (variables for center), radius);
  13. }
  14. private void getCircle(Graphics drawingArea, Pen penToUse, int xPos, int yPos, double radius);
  15.  
  16. {
  17. }
  18.  
  19. }
  20.  
  21. private void button1_Click(object sender, EventArgs e)
  22. {
  23. int centerX;
  24. int centerY;
  25. int radius;
  26.  
  27. if (!int.TryParse(textBox2.Text, out centerX))
  28. return;
  29. if (!int.TryParse(textBox3.Text, out centerY))
  30. return;
  31. if(! int.TryParse(textBox1.Text,out radius))
  32. return;
  33.  
  34. Point center = new Point(centerX, centerY);
  35.  
  36. Graphics paper;
  37. paper = pictureBox1.CreateGraphics();
  38. Pen pen = new Pen(Color.Black);
  39. getCircle(paper, pen, center, radius);
  40.  
  41. }
  42.  
  43. private void getCircle(Graphics drawingArea, Pen penToUse, Point center, int radius)
  44. {
  45. Rectangle rect = new Rectangle(center.X-radius, center.Y-radius,radius*2,radius*2);
  46. drawingArea.DrawEllipse(penToUse,rect);
  47. }
Add Comment
Please, Sign In to add comment