using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace _11._03._19 { public partial class Form1 : Form { private System.Drawing.Graphics g; private System.Drawing.Pen pen1 = new System.Drawing.Pen(Color.Red, 3); public Form1() { InitializeComponent(); g = pictureBox1.CreateGraphics(); } private void button1_Click(object sender, EventArgs e) { double x=0; double y=0; double r; double n; double alfa = 0; Double.TryParse(textBox1.Text, out n); Double.TryParse(textBox2.Text, out r); double przyrost_alfa=(2*Math.PI)/n; double x0 = r * Math.Cos(przyrost_alfa); double y0 = r * Math.Sin(przyrost_alfa); pictureBox1.Refresh(); for (int i = 0; i <= n; i++) { alfa = alfa + przyrost_alfa; x = r * Math.Cos(alfa); y = r * Math.Sin(alfa); g.DrawLine(pen1, (float)x0+pictureBox1.Width/2, (float)y0+pictureBox1.Height / 2, (float)x + pictureBox1.Width / 2, (float)y + pictureBox1.Height / 2); x0 = x; y0 = y; } } private void label2_Click(object sender, EventArgs e) { } private void textBox1_TextChanged(object sender, EventArgs e) { } private void textBox2_TextChanged(object sender, EventArgs e) { } private void pictureBox1_Click(object sender, EventArgs e) { } private void button2_Click(object sender, EventArgs e) { double x = 0; double y = 0; double r; double n; double alfa=0; Double.TryParse(textBox1.Text, out n); Double.TryParse(textBox2.Text, out r); double przyrost_alfa; Double.TryParse(textBox1.Text, out przyrost_alfa); double x0 = r * Math.Cos(przyrost_alfa); double y0 = r * Math.Sin(przyrost_alfa); pictureBox1.Refresh(); for (int i = 0; i <= n; i++) { alfa = alfa + przyrost_alfa; x = r * Math.Cos(alfa); y = r * Math.Sin(alfa); g.DrawLine(pen1, (float)x0 + pictureBox1.Width / 2, (float)y0 + pictureBox1.Height / 2, (float)x + pictureBox1.Width / 2, (float)y + pictureBox1.Height / 2); x0 = x; y0 = y; } } private void button3_Click(object sender, EventArgs e) { double x = 0; double y = 0; double r; double n; double alfa = 0; Double.TryParse(textBox1.Text, out n); Double.TryParse(textBox2.Text, out r); double przyrost_alfa = (2 * Math.PI) / n; double x0 = r * Math.Cos(przyrost_alfa); double y0 = r * Math.Sin(przyrost_alfa); pictureBox1.Refresh(); for (int i = 0; i <=7* n; i++) { alfa = alfa + przyrost_alfa; x = r * Math.Cos(alfa); y = r * Math.Sin(alfa); g.DrawLine(pen1, (float)x0 + pictureBox1.Width / 2, (float)y0 + pictureBox1.Height / 2, (float)x + pictureBox1.Width / 2, (float)y + pictureBox1.Height / 2); x0 = x; y0 = y; r = r - 0.5; } } } }