工具箱相关
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. using GrxCAD.DatabaseServices;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. namespace HCTools
  12. {
  13. public partial class CheckL : Form
  14. {
  15. public CheckL()
  16. {
  17. InitializeComponent();
  18. }
  19. private void btn_OK_Click(object sender, EventArgs e)
  20. {
  21. int num = 0;
  22. if (comboBox_jqx.Text == "")
  23. {
  24. GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择计曲线所在图层");
  25. return;
  26. }
  27. if (comboBox_sqx.Text == "")
  28. {
  29. GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择首曲线所在图层");
  30. return;
  31. }
  32. if (textBox_Gap.Text == "")
  33. {
  34. GrxCAD.ApplicationServices.Application.ShowAlertDialog("请输入等高距");
  35. return;
  36. }
  37. if (int.TryParse(textBox_Gap.Text.ToString(), out num) == false)
  38. {
  39. GrxCAD.ApplicationServices.Application.ShowAlertDialog("等高距必须为整数");
  40. return;
  41. }
  42. CheckContourLine.gap = Convert.ToInt32(textBox_Gap.Text);
  43. CheckContourLine.jqx = comboBox_jqx.Text;
  44. CheckContourLine.sqx = comboBox_sqx.Text;
  45. this.Close();
  46. CheckContourLine ccline = new CheckContourLine();
  47. ccline.Valuecheck();
  48. this.Close();
  49. }
  50. private void CheckL_Load(object sender, EventArgs e)
  51. {
  52. this.comboBox_jqx.DropDownStyle = ComboBoxStyle.DropDownList;
  53. this.comboBox_sqx.DropDownStyle = ComboBoxStyle.DropDownList;
  54. //自动填充下拉框
  55. Database database = GrxCAD.DatabaseServices.HostApplicationServices.WorkingDatabase;
  56. using (Transaction traction = database.TransactionManager.StartTransaction())
  57. {
  58. //存放所有图层名
  59. List<string> alllayername = new List<string>();
  60. LayerTable layertable = traction.GetObject(database.LayerTableId, OpenMode.ForRead) as LayerTable;
  61. foreach (ObjectId objid in layertable)
  62. {
  63. LayerTableRecord layertablerecord = traction.GetObject(objid, OpenMode.ForRead) as LayerTableRecord;
  64. alllayername.Add(layertablerecord.Name);
  65. }
  66. alllayername.Sort();
  67. for (int i = 0; i < alllayername.Count; i++)
  68. {
  69. this.comboBox_jqx.Items.Add(alllayername[i]);
  70. this.comboBox_sqx.Items.Add(alllayername[i]);
  71. }
  72. if (alllayername.Contains("8110"))
  73. {
  74. int index = alllayername.IndexOf("8110");
  75. this.comboBox_sqx.SelectedIndex = index;
  76. }
  77. if (alllayername.Contains("8120"))
  78. {
  79. int index = alllayername.IndexOf("8120");
  80. this.comboBox_jqx.SelectedIndex = index;
  81. }
  82. traction.Commit();
  83. }
  84. }
  85. private void btn_Cancel_Click(object sender, EventArgs e)
  86. {
  87. this.Close();
  88. }
  89. }
  90. }