Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Graphics gr;
- int x, y, a, b, dx, x0, y0, x1, y1, R, y2, x2;
- double fi, dfi, fi1;
- private void button1_Click(object sender, EventArgs e)
- {
- gr = pictureBox1.CreateGraphics();
- gr.Clear(Color.White);
- x0 = pictureBox1.Width / 2;
- y0 = pictureBox1.Height / 2;
- R = 100;
- x1 = x0 + R;
- y1 = y0;
- x2 = x0;
- y2 = y0-R;
- fi = 0;
- fi1 = 80;
- dfi = Math.PI / 30;
- gr.DrawLine(Pens.DarkBlue, x0, y0, x1, y1);
- gr.DrawLine(Pens.DarkBlue, x0, y0, x2, y2);
- timer1.Start();
- }
- private void timer1_Tick(object sender, EventArgs e)
- {
- gr.DrawLine(Pens.White, x0, y0, x1, y1);
- gr.DrawLine(Pens.White, x0, y0, x2, y2);
- fi = fi + dfi;
- fi1 = fi1 + dfi;
- x2 = (int)(x0 + R * Math.Cos(fi1));
- y2 = (int)(y0 + R * Math.Sin(fi1));
- x1 = (int)(x0 + R * Math.Cos(fi));
- y1 = (int)(y0 + R * Math.Sin(fi));
- gr.DrawLine(Pens.DarkBlue, x0, y0, x1, y1);
- gr.DrawLine(Pens.DarkBlue, x0, y0, x2, y2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement