工具箱相关
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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using GrxCAD.EditorInput;
  11. using GrxCAD.DatabaseServices;
  12. using GrxCAD.Geometry;
  13. namespace HCTools
  14. {
  15. public partial class Hierak : Form
  16. {
  17. public Hierak()
  18. {
  19. InitializeComponent();
  20. }
  21. private void Hierak_Load(object sender, EventArgs e)
  22. {
  23. this.comboBox_CrtLayer.DropDownStyle = ComboBoxStyle.DropDownList;
  24. this.MaximizeBox = false;
  25. this.StartPosition = FormStartPosition.CenterScreen;
  26. Database database = GrxCAD.DatabaseServices.HostApplicationServices.WorkingDatabase;
  27. using (Transaction traction = database.TransactionManager.StartTransaction())
  28. {
  29. //存放所有图层名
  30. List<string> alllayername = new List<string>();
  31. LayerTable layertable = traction.GetObject(database.LayerTableId, OpenMode.ForRead) as LayerTable;
  32. foreach (ObjectId objid in layertable)
  33. {
  34. LayerTableRecord layertablerecord = traction.GetObject(objid, OpenMode.ForRead) as LayerTableRecord;
  35. alllayername.Add(layertablerecord.Name);
  36. }
  37. alllayername.Sort();
  38. for (int i = 0; i < alllayername.Count; i++)
  39. {
  40. this.comboBox_CrtLayer.Items.Add(alllayername[i]);
  41. }
  42. if (alllayername.Contains("8110"))
  43. {
  44. int index = alllayername.IndexOf("8110");
  45. this.comboBox_CrtLayer.SelectedIndex = index;
  46. }
  47. traction.Commit();
  48. }
  49. }
  50. private void btn_OK_Click(object sender, EventArgs e)
  51. {
  52. if (textBox_Gap.Text == "")
  53. {
  54. GrxCAD.ApplicationServices.Application.ShowAlertDialog("请输入等高距");
  55. return;
  56. }
  57. if (comboBox_CrtLayer.Text == "")
  58. {
  59. GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择当前等高线所在图层");
  60. return;
  61. }
  62. Hierarchy.gap = Convert.ToInt32(textBox_Gap.Text.ToString());
  63. Hierarchy.CrtLayerName = comboBox_CrtLayer.Text;
  64. this.Close();
  65. Hierarchy hier = new Hierarchy();
  66. hier.hierarchy();
  67. }
  68. private void btn_Cancel_Click(object sender, EventArgs e)
  69. {
  70. this.Close();
  71. }
  72. }
  73. }