Advertisement
Misipuk

lab

Dec 22nd, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.23 KB | None | 0 0
  1. Graphics gr;
  2.         int x, y, a, b, dx, x0, y0, x1, y1, R, y2, x2;
  3.         double fi, dfi, fi1;
  4.         private void button1_Click(object sender, EventArgs e)
  5.         {
  6.             gr = pictureBox1.CreateGraphics();
  7.             gr.Clear(Color.White);
  8.             x0 = pictureBox1.Width / 2;
  9.             y0 = pictureBox1.Height / 2;
  10.             R = 100;
  11.             x1 = x0 + R;
  12.             y1 = y0;
  13.             x2 = x0;
  14.             y2 = y0-R;
  15.             fi = 0;
  16.             fi1 = 80;
  17.             dfi = Math.PI / 30;
  18.             gr.DrawLine(Pens.DarkBlue, x0, y0, x1, y1);
  19.             gr.DrawLine(Pens.DarkBlue, x0, y0, x2, y2);
  20.             timer1.Start();
  21.          
  22.         }
  23.  
  24.         private void timer1_Tick(object sender, EventArgs e)
  25.         {
  26.             gr.DrawLine(Pens.White, x0, y0, x1, y1);
  27.             gr.DrawLine(Pens.White, x0, y0, x2, y2);
  28.             fi = fi + dfi;
  29.             fi1 = fi1 + dfi;
  30.             x2 = (int)(x0 + R * Math.Cos(fi1));
  31.             y2 = (int)(y0 + R * Math.Sin(fi1));
  32.             x1 = (int)(x0 + R * Math.Cos(fi));
  33.             y1 = (int)(y0 + R * Math.Sin(fi));
  34.             gr.DrawLine(Pens.DarkBlue, x0, y0, x1, y1);
  35.             gr.DrawLine(Pens.DarkBlue, x0, y0, x2, y2);
  36.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement