获取数据代码如下:
private void 获取数据_Click(object sender, EventArgs e)
{
INput put = new INput();
put.Input(textBox1, textBox2, textBox3,textBox4,textBox5, textBox6, textBox7, textBox8, textBox9, textBox10, textBox11, textBox12, textBox13, textBox14, textBox15, textBox16, textBox17);
}
class INput
{
public void Input(TextBox textbox1, TextBox textbox2, TextBox textbox3, TextBox textbox4, TextBox textbox5, TextBox textbox6, TextBox textbox7, TextBox textbox8, TextBox textbox9, TextBox textbox10, TextBox textbox11, TextBox textbox12, TextBox textbox13, TextBox textbox14, TextBox textbox15, TextBox textbox16, TextBox textbox17)
{
double x1, x2, y1, y2, f;
double o1, o2, p1, p2, q1, q2;
double Xs1, Xs2, Ys1, Ys2, Zs1, Zs2;
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.ShowDialog();
string MyFileName = openFileDialog1.FileName;
if (MyFileName.Trim() == "")
return;
StreamReader sr = null;
sr = new StreamReader(MyFileName, System.Text.Encoding.Default);
Xs1 = double.Parse(sr.ReadLine());
Ys1 = double.Parse(sr.ReadLine());
Zs1 = double.Parse(sr.ReadLine());
o1 = double.Parse(sr.ReadLine());
p1 = double.Parse(sr.ReadLine());
q1 = double.Parse(sr.ReadLine());
Xs2 = double.Parse(sr.ReadLine());
Ys2 = double.Parse(sr.ReadLine());
Zs2 = double.Parse(sr.ReadLine());
o2 = double.Parse(sr.ReadLine());
p2 = double.Parse(sr.ReadLine());
q2 = double.Parse(sr.ReadLine());
x1 = double.Parse(sr.ReadLine());
y1 = double.Parse(sr.ReadLine());
x2 = double.Parse(sr.ReadLine());
y2 = double.Parse(sr.ReadLine());
f = double.Parse(sr.ReadLine());
textbox1.Text = Xs1.ToString("0.000000");
textbox2.Text = Ys1.ToString("0.000000");
textbox3.Text = Zs1.ToString("0.000000");
textbox4.Text = o1.ToString("0.000000");
textbox5.Text = p1.ToString("0.000000");
textbox6.Text = q1.ToString("0.000000");
textbox7.Text = Xs2.ToString("0.000000");
textbox8.Text = Ys2.ToString("0.000000");
textbox9.Text = Zs2.ToString("0.000000");
textbox10.Text = o2.ToString("0.000000");
textbox11.Text = p2.ToString("0.000000");
textbox12.Text = q2.ToString("0.000000");
textbox13.Text = x1.ToString("0.000000");
textbox14.Text = y1.ToString("0.000000");
textbox15.Text = x2.ToString("0.000000");
textbox16.Text = y2.ToString("0.000000");
textbox17.Text = f.ToString("0.000000");
}
}