工具箱相关
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

DGXGeneral.cs 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using GrxCAD.DatabaseServices;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows.Forms;
  12. namespace HCTools
  13. {
  14. public partial class DGXGeneral : Form
  15. {
  16. public DGXGeneral()
  17. {
  18. InitializeComponent();
  19. }
  20. private void DGXGeneral_Load(object sender, EventArgs e)
  21. {
  22. this.comboBox_dgj.DropDownStyle = ComboBoxStyle.DropDownList;
  23. Database database = GrxCAD.DatabaseServices.HostApplicationServices.WorkingDatabase;
  24. using (Transaction traction = database.TransactionManager.StartTransaction())
  25. {
  26. //存放所有图层名
  27. List<string> alllayername = new List<string>();
  28. LayerTable layertable = traction.GetObject(database.LayerTableId, OpenMode.ForRead) as LayerTable;
  29. foreach (ObjectId objid in layertable)
  30. {
  31. LayerTableRecord layertablerecord = traction.GetObject(objid, OpenMode.ForRead) as LayerTableRecord;
  32. alllayername.Add(layertablerecord.Name);
  33. }
  34. alllayername.Sort();
  35. for (int i = 0; i < alllayername.Count; i++)
  36. {
  37. this.checkedListBox_dgxtc.Items.Add(alllayername[i]);
  38. }
  39. traction.Commit();
  40. }
  41. }
  42. private void butn_ok_Click(object sender, EventArgs e)
  43. {
  44. ArrayList eplayerlist = new ArrayList();
  45. if (checkedListBox_dgxtc.CheckedItems.Count > 0)
  46. {
  47. int count = checkedListBox_dgxtc.CheckedItems.Count;
  48. for (int i = 0; i < count; i++)
  49. {
  50. eplayerlist.Add(checkedListBox_dgxtc.CheckedItems[i].ToString());
  51. }
  52. }
  53. else
  54. {
  55. MessageBox.Show("请选择处理等高线图层!", "警告");
  56. return;
  57. }
  58. if (comboBox_dgj.Text == "")
  59. {
  60. GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择等高距");
  61. return;
  62. }
  63. DGXGeneralization.dgxlayerlist = eplayerlist;
  64. DGXGeneralization.dgj = double.Parse(comboBox_dgj.Text);
  65. DGXGeneralization.dgxGeneralization();
  66. this.Close();
  67. }
  68. }
  69. }