Exemple #1
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (this.uC_Line1.IsValid())
     {
         var a = this.uC_Line1.A;
         var b = this.uC_Line1.B;
         var c = this.uC_Line1.C;
         //判断方程的参数,是否有效
         LinearEquation linear = new LinearEquation()
         {
             A = a, B = b, C = c
         };
         if (!linear.IsValid())
         {
             MessageBox.Show("输入的方程参数无效");
             return;
         }
         if (!this.axisControl1.CheckLineIsValid(linear))
         {
             MessageBox.Show("输入的方程不在坐标轴内");
             return;
         }
         bool flag = this.axisControl1.GenerateLinear(linear);
         if (!flag)
         {
             MessageBox.Show("生成直线失败");
             return;
         }
     }
 }
Exemple #2
0
        private void button8_Click(object sender, EventArgs e)
        {
            if (this.uC_Line1.IsValid())
            {
                var a = this.uC_Line1.A;
                var b = this.uC_Line1.B;
                var c = this.uC_Line1.C;
                //判断方程的参数,是否有效
                LinearEquation linear = new LinearEquation()
                {
                    A = a, B = b, C = c
                };
                if (!linear.IsValid())
                {
                    MessageBox.Show("输入的方程参数无效");
                    return;
                }
                if (!this.axisControl1.CheckLineIsValid(linear))
                {
                    MessageBox.Show("输入的方程不在坐标轴内");
                    return;
                }

                List <PointF> lstPoints = this.axisControl1.GetLinerPointsFromLinearEquation(linear);
                foreach (var ele in lstPoints)
                {
                    axisControl1.GeneratePoint(ele);
                }
            }
        }
Exemple #3
0
        private async void button12_Click(object sender, EventArgs e)
        {
            if (this.uC_Line1.IsValid())
            {
                var a = this.uC_Line1.A;
                var b = this.uC_Line1.B;
                var c = this.uC_Line1.C;
                //判断方程的参数,是否有效
                LinearEquation linear = new LinearEquation()
                {
                    A = a, B = b, C = c
                };
                if (!linear.IsValid())
                {
                    MessageBox.Show("输入的方程参数无效");
                    return;
                }
                if (!this.axisControl1.CheckLineIsValid(linear))
                {
                    MessageBox.Show("输入的方程不在坐标轴内");
                    return;
                }
                int           x         = -axisControl1.AxisY.Max;
                List <PointF> lstPoints = new List <PointF>();

                int    acc = 1;
                double t   = 1;
                while (x < axisControl1.AxisY.Max)
                {
                    float y = linear.GetValueFromX(x);
                    lstPoints.Add(new PointF(x, y));
                    t += 1;
                    x  = (int)(acc * t * t / 2);
                }



                foreach (var ele in lstPoints)
                {
                    //axisControl1.GeneratePoint(ele);
                    axisControl1.MoveButton(ele);
                    await Task.Delay(30);
                }
            }
        }