Esempio n. 1
0
        private void Follow_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.S)
            {
                startPoint1 = new Point(200, 100);
                endPoint1   = new Point(300, 160);
                for (int i = startPoint1.X + (endPoint1.X - startPoint1.X) / 4; i < endPoint1.X - (endPoint1.X - startPoint1.X) / 4; i++)
                {
                    for (int j = startPoint1.Y + (endPoint1.Y - startPoint1.Y) / 4; j < endPoint1.Y - (endPoint1.Y - startPoint1.Y) / 4; j++)
                    {
                        initList.Add(new Point(i, j));
                    }
                }
                startFollow     = true;
                timeLabel.Text  = "计时:0";
                scoreLabel.Text = "";
                counter         = 0;
                Timer.Enabled   = true;
                Timer.Start();
            }
            else if (e.KeyCode == Keys.E)
            {
                Graphics hitPointGra = this.CreateGraphics();
                Brush    hitPoint    = new SolidBrush(Color.Red);
                hitPointGra.FillEllipse(hitPoint, Control.MousePosition.X - 115, Control.MousePosition.Y - 73, 7f, 7f);

                if (isRuin && followTime >= 2)
                {
                    scoreLabel.Text = "跟踪了" + followTime.ToString() + "秒\n" + "命中目标\n" + "成绩合格";
                }
                else if (isRuin && followTime < 2)
                {
                    scoreLabel.Text = "跟踪了" + followTime.ToString() + "秒\n" + "命中目标\n" + "成绩不合格";
                }
                else
                {
                    scoreLabel.Text = "跟踪了" + followTime.ToString() + "秒\n" + "没有命中目标\n" + "成绩不合格";
                }
                MySQLiteClass.Getmysqlcom("insert into ConScore(Number,平稳跟踪目标,训练时间) values('" + MainWindow.number + "','" + scoreLabel.Text + "','" + DateTime.Now.ToString() + "')");
                startFollow = false;
                Timer.Dispose();
                Timer.Enabled = false;
                initList.Clear();
                pointList.Clear();
            }
            else if (e.KeyCode == Keys.Escape)
            {
                GC.Collect();
                this.Dispose();
            }
        }
Esempio n. 2
0
 private void Draw_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.S)
     {
         this.Refresh();
         SetCursorPos(startPoint1.X + 115, startPoint1.Y + 73);
         startDraw       = true;
         timeLabel.Text  = "计时:0";
         scoreLabel.Text = "";
         counter         = 0;
         Timer.Enabled   = true;
         Timer.Start();
     }
     else if (e.KeyCode == Keys.E)
     {
         startDraw   = false;
         compareList = initList.Intersect(pointList).ToList();
         double res = Math.Round((double)compareList.Count * 5 / initList.Count, 2);
         if (counter < 25 && (res * 100) >= 60)
         {
             scoreLabel.Text = "相似度:" + (res * 100).ToString() + "%\n" + "成绩:优秀";
         }
         else if (counter < 30 && (res * 100) >= 45 && (res * 100) < 60)
         {
             scoreLabel.Text = "相似度:" + (res * 100).ToString() + "%\n" + "成绩:良好";
         }
         else if (counter < 35 && (res * 100) >= 30 && (res * 100) < 45)
         {
             scoreLabel.Text = "相似度:" + (res * 100).ToString() + "%\n" + "成绩:合格";
         }
         else
         {
             scoreLabel.Text = "相似度:" + (res * 100).ToString() + "%\n" + "成绩:不及格";
         }
         MySQLiteClass.Getmysqlcom("insert into ConScore(Number,描绘信封靶,训练时间) values('" + MainWindow.number + "','" + scoreLabel.Text + "','" + DateTime.Now.ToString() + "')");
         Timer.Dispose();
         Timer.Enabled = false;
         pointList.Clear();
     }
     else if (e.KeyCode == Keys.Escape)
     {
         GC.Collect();
         this.Dispose();
     }
 }