示例#1
0
文件: Line.cs 项目: djvorr/SSE
 public Line(Point start, Point end, Color color, Center center, int radius, double angle)
 {
     this.start = start;
     this.end = end;
     this.center = center;
     this.start.setX(center.getX());
     this.start.setY(center.getY());
     this.radius = radius;
     setColor(color);
     this.angle = angle;
     setAngle(angle);
 }
示例#2
0
文件: Form1.cs 项目: djvorr/SSE
        private void Form1_Load(object sender, EventArgs e)
        {
            clock = new Clock(1000);

            //padding = 10;
            angle = 0;

            center = new Center(this.Width/2 + 1, this.Height/2 + 1);
            //int x = Width/2 + 1, y = Height/2 + 1;
            //MessageBox.Show(x + " " + y);

            radius = Width - center.getX();// - padding;

            //Form1_Paint(this, null);
            //MessageBox.Show("");

            Point start = new Point(0, 0);
            Point end = new Point(Width - padding, center.getY());
            Line line = new Line(start, end, Color.Blue, center, radius, 0);
            ThreadControl tc = new ThreadControl(line, clock, density);
            controls.Add(tc);

            Thread thread = new Thread(new ThreadStart(tc.listen));
            thread.Start();

            end = new Point(Width - padding, center.getY());
            line = new Line(start, end, Color.Purple, center, radius, Math.PI);
            line.setAngle(Math.PI);
            tc = new ThreadControl(line, clock, density);
            controls.Add(tc);

            thread = new Thread(new ThreadStart(tc.listen));
            thread.Start();

            end = new Point(Width - padding, center.getY());
            line = new Line(start, end, Color.Red, center, radius, Math.PI / 2);
            line.setAngle(Math.PI / 2);
            tc = new ThreadControl(line, clock, density);
            controls.Add(tc);

            thread = new Thread(new ThreadStart(tc.listen));
            thread.Start();

            end = new Point(Width - padding, center.getY());
            line = new Line(start, end, Color.Yellow, center, radius, Math.PI * 3 / 2);
            line.setAngle(Math.PI * 3 / 2);
            tc = new ThreadControl(line, clock, density);
            controls.Add(tc);

            thread = new Thread(new ThreadStart(tc.listen));
            thread.Start();

            Thread drawthread = new Thread(new ThreadStart(this.Draw));
            drawthread.Start();


            //System.Threading.Thread.Sleep(000);
            //Close();

            //for (int i = 0; i < 1; i++)
            //{
            //    start = new Point(0, 0);
            //    end = new Point(Width - padding, center.getY());
            //    line = new Line(start, end, Color.Blue, center, radius, incrementor.getNext());
            //    controls.Add(new ThreadControl(line));
            //}
            /*
            start = new Point(0, 0);
            end = new Point(Width - padding, center.getY());
            line = new Line(start, end, Color.Blue, center, radius, Math.PI/2);
            controls.Add(new ThreadControl(line));

            start = new Point(0, 0);
            end = new Point(Width - padding, center.getY());
            line = new Line(start, end, Color.Blue, center, radius, Math.PI*2);
            controls.Add(new ThreadControl(line));
            */
            //Form1_Paint(this, null);

        }