using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using GrxCAD.EditorInput; using GrxCAD.DatabaseServices; using GrxCAD.Geometry; namespace HCTools { public partial class PtCheck : Form { public PtCheck() { InitializeComponent(); } private void PtCheck_Load(object sender, EventArgs e) { this.comboBox_ElePoint.DropDownStyle = ComboBoxStyle.DropDownList; this.MaximizeBox = false; this.StartPosition = FormStartPosition.CenterScreen; //自动填充下拉框 Database database = GrxCAD.DatabaseServices.HostApplicationServices.WorkingDatabase; using (Transaction traction = database.TransactionManager.StartTransaction()) { //存放所有图层名 List alllayername = new List(); LayerTable layertable = traction.GetObject(database.LayerTableId, OpenMode.ForRead) as LayerTable; foreach (ObjectId objid in layertable) { LayerTableRecord layertablerecord = traction.GetObject(objid, OpenMode.ForRead) as LayerTableRecord; alllayername.Add(layertablerecord.Name); } alllayername.Sort(); for (int i = 0; i < alllayername.Count; i++) { this.comboBox_ElePoint.Items.Add(alllayername[i]); } if (alllayername.Contains("8300")) { int index = alllayername.IndexOf("8300"); this.comboBox_ElePoint.SelectedIndex = index; } traction.Commit(); } } private void btn_OK_Click(object sender, EventArgs e) { if (comboBox_ElePoint.Text == "") { GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择高程点图层"); return; } if (comboBox_blc.Text == "") { GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择比例尺"); return; } ElePtCheck.EleLayerName = comboBox_ElePoint.Text; string blctext = comboBox_blc.Text; int blcindex = blctext.LastIndexOf(':'); string strblc = blctext.Substring(blcindex + 1); ElePtCheck.blc = Convert.ToInt32(strblc); this.Close(); ElePtCheck ptcheck = new ElePtCheck(); ptcheck.pointcheck(); } private void btn_Cancel_Click(object sender, EventArgs e) { this.Close(); } } }