二阶段12.13

        今天,我们为三角高程计算设计了窗口及控件,并且增加了

度分秒快捷键,使得输入更加方便。增加了度娘和资料标准

的链接,方便在疑惑的时候查询。增加一个高程小计,方便

查看和记录,使得数据很客观。同时也将程序编写完成。

真的累啊!!

 

程序代码:

private void button2_Click(object sender, EventArgs e)
{
string s = textBox1.Text;
string[] ss = s.Split(new char[3] { '°', '′', '″' }, StringSplitOptions.RemoveEmptyEntries);
double[] d = new double[ss.Length];
double sign = d[0] >= 0.0 ? 1.0 : -1.0;
for (int i = 0; i < d.Length; i++)
d[i] = Convert.ToDouble(ss[i]);

double rad = 0;
if (d.Length == 1)
rad = d[0] * Math.PI / 180;
else if (d.Length == 2)
rad = (d[0] + d[1] / 60) * Math.PI / 180;
else
rad = (d[0] + d[1] / 60 + d[2] / 3600) * Math.PI / 180;
rad = sign * rad;

textBox3.Text = Convert.ToString(Math.Round(Math.Sin(rad), 5));
textBox4.Text = Convert.ToString(Math.Round(Math.Cos(rad), 5));
textBox2.Text = Convert.ToString(Math.Round(rad, 5));
double xieju = Convert.ToDouble(textBox5.Text);
double yigao = Convert.ToDouble(textBox10.Text);
double chigao = Convert.ToDouble(textBox11.Text);
textBox6.Text = Convert.ToString(Math.Round((Math.Sin(rad) * xieju + yigao - chigao), 5));
textBox7.Text = Convert.ToString(Math.Round(xieju * Math.Cos(rad), 5));
textBox8.AppendText(textBox6.Text);
textBox8.AppendText("\r\n");
}

 

posted @ 2018-12-13 23:20  小呆呆团队  阅读(88)  评论(0编辑  收藏  举报