C#学生遇到程序调试异常,求精通大神帮忙
using System;using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace 距离
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
int x1 = Convert.ToInt32(textBox2.Text);
int y1 = Convert.ToInt32(textBox1.Text);
int x2 = Convert.ToInt32(textBox3.Text);
int y2 = Convert.ToInt32(textBox4.Text);
Point p1 = new Point(x1, y1);
Point p2 = new Point(x2, y2);
label7.Text = p1.Distance(p2).ToString();
}
class Point
{
public int X, Y;
public Point(int I, int J) { X = I; Y = J; }
public double Distance(Point p)
{
return System.Math.Sqrt((this.X - p.X) * (this.X - p.X) + (this.Y - p.Y) * (this.Y - p.Y));
}
}
}
}