工具箱相关
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

Form1.cs 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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 Thumbnail
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. }
  19. private void Form1_Load(object sender, EventArgs e)
  20. {
  21. textBox_files.Text = Properties.Settings.Default.files;
  22. textBox_tk.Text = Properties.Settings.Default.jtb;
  23. textBox_iplfiles.Text = Properties.Settings.Default.svpath;
  24. textBox_tkn.Text = Properties.Settings.Default.tk;
  25. textBox_tfh.Text = Properties.Settings.Default.tfh;
  26. }
  27. private void button_files_Click(object sender, EventArgs e)
  28. {
  29. FolderBrowserDialog open = new FolderBrowserDialog();
  30. open.Description = "请选择文件夹";
  31. if (open.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  32. textBox_files.Text = open.SelectedPath;
  33. }
  34. private void button_tk_Click(object sender, EventArgs e)
  35. {
  36. OpenFileDialog open = new OpenFileDialog();
  37. open.Title = "请选择文件";
  38. if (open.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  39. textBox_tk.Text = open.FileName;
  40. }
  41. private void button_iplfiles_Click(object sender, EventArgs e)
  42. {
  43. FolderBrowserDialog open = new FolderBrowserDialog();
  44. open.Description = "请选择文件夹";
  45. if (open.ShowDialog() == DialogResult.OK)
  46. textBox_iplfiles.Text = open.SelectedPath;
  47. }
  48. private void button_ok_Click(object sender, EventArgs e)
  49. {
  50. if (string.IsNullOrEmpty(textBox_files.Text))
  51. {
  52. GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择待替换文件所在位置");
  53. return;
  54. }
  55. if (string.IsNullOrEmpty(textBox_tk.Text))
  56. {
  57. GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择截图表所在位置");
  58. return;
  59. }
  60. if (string.IsNullOrEmpty(textBox_iplfiles.Text))
  61. {
  62. GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择替换后文件保存位置");
  63. return;
  64. }
  65. if (string.IsNullOrEmpty(textBox_tkn.Text))
  66. {
  67. GrxCAD.ApplicationServices.Application.ShowAlertDialog("请输入结合表图框所在图层");
  68. return;
  69. }
  70. if (string.IsNullOrEmpty(textBox_tfh.Text))
  71. {
  72. GrxCAD.ApplicationServices.Application.ShowAlertDialog("请输入结合表图幅号所在图层");
  73. return;
  74. }
  75. if (string.IsNullOrEmpty(comboBox_blc.Text))
  76. {
  77. GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择比例尺");
  78. return;
  79. }
  80. getThumbnail getthumbnail = new getThumbnail();
  81. string blctext = comboBox_blc.Text;
  82. int blcindex = blctext.LastIndexOf(':');
  83. string strblc = blctext.Substring(blcindex + 1);
  84. double blc = Convert.ToDouble(strblc);
  85. getThumbnail.bl = blc / 500.0;
  86. getThumbnail.tc_tfh = textBox_tfh.Text.Trim();
  87. getThumbnail.tc_tk = textBox_tkn.Text.Trim();
  88. #region 外图框与接图表距离
  89. //if (blc == 500)
  90. //{
  91. // getThumbnail.jtk = 1;
  92. //}
  93. //if (blc == 1000)
  94. //{
  95. // getThumbnail.jtk = 1;
  96. //}
  97. //if (blc == 2000)
  98. //{
  99. // getThumbnail.jtk = 2;
  100. //}
  101. //if (blc == 5000)
  102. //{
  103. // getThumbnail.jtk = 4;
  104. //}
  105. //if (blc == 10000)
  106. //{
  107. // getThumbnail.jtk = 8;
  108. //}
  109. //if (blc == 20000)
  110. //{
  111. // getThumbnail.jtk = 16;
  112. //}
  113. #endregion
  114. getthumbnail.openDwg(textBox_files.Text, textBox_tk.Text, textBox_iplfiles.Text);
  115. Properties.Settings.Default.files = textBox_files.Text;
  116. Properties.Settings.Default.jtb = textBox_tk.Text;
  117. Properties.Settings.Default.svpath = textBox_iplfiles.Text;
  118. Properties.Settings.Default.tk = textBox_tkn.Text;
  119. Properties.Settings.Default.tfh = textBox_tfh.Text;
  120. Properties.Settings.Default.Save();
  121. this.Close();
  122. //getThumbnail getthumbnail = new getThumbnail();
  123. //getThumbnail.bl = 4;
  124. //getThumbnail.tc_tfh = "0";
  125. //getThumbnail.tc_tk = "TK";
  126. //getthumbnail.openDwg("F://2022//2022-11//接图表替换//t//1", "F://2022//2022-11//接图表替换//t//新建文件夹//Drawing2.dwg",
  127. // "F://2022//2022-11//接图表替换//t");
  128. //getthumbnail.openDwg("F://2022//2022-11//接图表替换//重新套图框/雅砻江牙根二级水电站可研阶段库区地形地类图(含水下)-2000",
  129. // "F://2022//2022-11//接图表替换//2000库区分幅结合表-CGCS2000-102.dwg",
  130. // "F://2022//2022-11//接图表替换//重新套图框");
  131. }
  132. }
  133. }