示例#1
0
        private void btn_Ok_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.te_A1.Text == "" || this.te_B1.Text == "" || this.te_C1.Text == "" ||
                    this.te_A2.Text == "" || this.te_B2.Text == "" || this.te_C2.Text == "" ||
                    this.te_A3.Text == "" || this.te_C3.Text == "")
                {
                    XtraMessageBox.Show("请填写转换参数", "坐标转换");
                    return;
                }
                else
                {
                    convertPara = new double[8];
                    double para = Double.MaxValue;
                    if (Transfer(te_A1, ref para))
                    {
                        convertPara[0] = para;
                    }
                    else
                    {
                        return;
                    }
                    if (Transfer(te_B1, ref para))
                    {
                        convertPara[1] = para;
                    }
                    else
                    {
                        return;
                    }
                    if (Transfer(te_C1, ref para))
                    {
                        convertPara[2] = para;
                    }
                    else
                    {
                        return;
                    }
                    if (Transfer(te_A2, ref para))
                    {
                        convertPara[3] = para;
                    }
                    else
                    {
                        return;
                    }
                    if (Transfer(te_B2, ref para))
                    {
                        convertPara[4] = para;
                    }
                    else
                    {
                        return;
                    }
                    if (Transfer(te_C2, ref para))
                    {
                        convertPara[5] = para;
                    }
                    else
                    {
                        return;
                    }
                    if (Transfer(te_A3, ref para))
                    {
                        convertPara[6] = para;
                    }
                    else
                    {
                        return;
                    }
                    if (Transfer(te_C3, ref para))
                    {
                        convertPara[7] = para;
                    }
                    else
                    {
                        return;
                    }
                }


                if (te_MdbPath.Text == "")
                {
                    XtraMessageBox.Show("请指定文件存放路径", "坐标转换");
                }
                else
                {
                    m_Name = System.IO.Path.GetFileName(te_MdbPath.Text);
                    if (m_Name.Length > 4)
                    {
                        if (m_Name.Substring(m_Name.Length - 4) == ".mdb")
                        {
                            m_path = System.IO.Path.GetDirectoryName(te_MdbPath.Text);
                        }
                    }
                    else
                    {
                        m_path = "";
                    }
                }
                IsRotationTextAnno = ce_RotationTextAnno.Checked;
                IsRotationNumAnno  = ce_RotationNumAnno.Checked;
                if (m_path == "")
                {
                    XtraMessageBox.Show("请重新指定文件存放路径", "坐标转换"); return;
                }
                CoordConvert coordConvert = new CoordConvert(convertPara, m_path, m_Name, IsRotationTextAnno, IsRotationNumAnno, m_Map);
                coordConvert.CoordConvertMap();
                XtraMessageBox.Show("坐标系转换完成!", "提示");
                btn_Cancel_Click(null, null);
            }
            catch (System.Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "提示");
                return;
            }
        }