示例#1
0
 private void txtGeom_TextChanged(object sender, EventArgs e)
 {
     try
     {
         double x1    = Convert.ToDouble(txtX1.Text);
         double x2    = Convert.ToDouble(txtX2.Text);
         double y1    = Convert.ToDouble(txtY1.Text);
         double y2    = Convert.ToDouble(txtY2.Text);
         double ratio = Convert.ToDouble(txtRazon.Text);
         txtDistance.Text = AnalyticGeometry.GetDistanceBetweenTwoPoints(x1, y1, x2, y2).ToString();
         double[] middlePoint = AnalyticGeometry.GetMiddlePoint(x1, y1, x2, y2);
         txtMiddle.Text = middlePoint[0] + ", " + middlePoint[1];
         txtSlope.Text  = AnalyticGeometry.GetSlope(x1, y1, x2, y2).ToString();
         double[] ratioPoint = AnalyticGeometry.GetPointInRatio(x1, y1, x2, y2, ratio);
         txtRatioPoint.Text = ratioPoint[0] + ", " + ratioPoint[1];
     }
     catch
     {
     }
 }