123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- using GrxCAD.DatabaseServices;
- 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;
-
- namespace HCTools
- {
- public partial class CheckL : Form
- {
- public CheckL()
- {
- InitializeComponent();
- }
-
- private void btn_OK_Click(object sender, EventArgs e)
- {
- int num = 0;
- if (comboBox_jqx.Text == "")
- {
- GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择计曲线所在图层");
- return;
- }
- if (comboBox_sqx.Text == "")
- {
- GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择首曲线所在图层");
- return;
- }
- if (textBox_Gap.Text == "")
- {
- GrxCAD.ApplicationServices.Application.ShowAlertDialog("请输入等高距");
- return;
- }
-
- if (int.TryParse(textBox_Gap.Text.ToString(), out num) == false)
- {
- GrxCAD.ApplicationServices.Application.ShowAlertDialog("等高距必须为整数");
- return;
- }
-
- CheckContourLine.gap = Convert.ToInt32(textBox_Gap.Text);
- CheckContourLine.jqx = comboBox_jqx.Text;
- CheckContourLine.sqx = comboBox_sqx.Text;
-
- this.Close();
- CheckContourLine ccline = new CheckContourLine();
- ccline.Valuecheck();
- this.Close();
- }
-
- private void CheckL_Load(object sender, EventArgs e)
- {
- this.comboBox_jqx.DropDownStyle = ComboBoxStyle.DropDownList;
- this.comboBox_sqx.DropDownStyle = ComboBoxStyle.DropDownList;
-
- //自动填充下拉框
- Database database = GrxCAD.DatabaseServices.HostApplicationServices.WorkingDatabase;
- using (Transaction traction = database.TransactionManager.StartTransaction())
- {
- //存放所有图层名
- List<string> alllayername = new List<string>();
- 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_jqx.Items.Add(alllayername[i]);
- this.comboBox_sqx.Items.Add(alllayername[i]);
- }
-
- if (alllayername.Contains("8110"))
- {
- int index = alllayername.IndexOf("8110");
- this.comboBox_sqx.SelectedIndex = index;
- }
- if (alllayername.Contains("8120"))
- {
- int index = alllayername.IndexOf("8120");
- this.comboBox_jqx.SelectedIndex = index;
- }
- traction.Commit();
- }
- }
-
- private void btn_Cancel_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- }
- }
|