private void btnAdd_Click(object sender, EventArgs e) { try { m_strText = tbText.Text; m_dbHeight = Convert.ToDouble(tbHeight.Text); m_dbWidthRatio = Convert.ToDouble(tbWidthRatio.Text); m_strModelName = tbModelID.Text; m_dbPosX = Convert.ToDouble(tbPosX.Text); m_dbPosY = Convert.ToDouble(tbPosY.Text); m_dbRotate = Convert.ToDouble(tbRoTate.Text); m_nLayer = Convert.ToInt32(tbLayer.Text); m_nHatchLayer = Convert.ToInt32(tbHatchLayer.Text); m_dbCharSpace = Convert.ToDouble(tbCharSpace.Text); m_dbLIneSpace = Convert.ToDouble(tbLineSpace.Text); m_strObjName = tbObjName.Text; } catch (System.Exception ex) { MessageBox.Show("输入的数据不合法!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } int nRet = CSharpInterface.HS_AddText2(m_strText, m_dbHeight, m_dbWidthRatio, m_bModel, m_strModelName, m_dbPosX, m_dbPosY, m_nAlign, m_dbRotate, m_nLayer, m_bHatch, m_nHatchLayer, m_dbCharSpace, m_dbLIneSpace, m_strObjName); if (nRet == 0) { MessageBox.Show("添加文本对象成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); ClickAdd = true; this.Close(); } else { MessageBox.Show("添加文本对象失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } }