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 Thumbnail { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { textBox_files.Text = Properties.Settings.Default.files; textBox_tk.Text = Properties.Settings.Default.jtb; textBox_iplfiles.Text = Properties.Settings.Default.svpath; textBox_tkn.Text = Properties.Settings.Default.tk; textBox_tfh.Text = Properties.Settings.Default.tfh; } private void button_files_Click(object sender, EventArgs e) { FolderBrowserDialog open = new FolderBrowserDialog(); open.Description = "请选择文件夹"; if (open.ShowDialog() == System.Windows.Forms.DialogResult.OK) textBox_files.Text = open.SelectedPath; } private void button_tk_Click(object sender, EventArgs e) { OpenFileDialog open = new OpenFileDialog(); open.Title = "请选择文件"; if (open.ShowDialog() == System.Windows.Forms.DialogResult.OK) textBox_tk.Text = open.FileName; } private void button_iplfiles_Click(object sender, EventArgs e) { FolderBrowserDialog open = new FolderBrowserDialog(); open.Description = "请选择文件夹"; if (open.ShowDialog() == DialogResult.OK) textBox_iplfiles.Text = open.SelectedPath; } private void button_ok_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBox_files.Text)) { GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择待替换文件所在位置"); return; } if (string.IsNullOrEmpty(textBox_tk.Text)) { GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择截图表所在位置"); return; } if (string.IsNullOrEmpty(textBox_iplfiles.Text)) { GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择替换后文件保存位置"); return; } if (string.IsNullOrEmpty(textBox_tkn.Text)) { GrxCAD.ApplicationServices.Application.ShowAlertDialog("请输入结合表图框所在图层"); return; } if (string.IsNullOrEmpty(textBox_tfh.Text)) { GrxCAD.ApplicationServices.Application.ShowAlertDialog("请输入结合表图幅号所在图层"); return; } if (string.IsNullOrEmpty(comboBox_blc.Text)) { GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择比例尺"); return; } getThumbnail getthumbnail = new getThumbnail(); string blctext = comboBox_blc.Text; int blcindex = blctext.LastIndexOf(':'); string strblc = blctext.Substring(blcindex + 1); double blc = Convert.ToDouble(strblc); getThumbnail.bl = blc / 500.0; getThumbnail.tc_tfh = textBox_tfh.Text.Trim(); getThumbnail.tc_tk = textBox_tkn.Text.Trim(); #region 外图框与接图表距离 //if (blc == 500) //{ // getThumbnail.jtk = 1; //} //if (blc == 1000) //{ // getThumbnail.jtk = 1; //} //if (blc == 2000) //{ // getThumbnail.jtk = 2; //} //if (blc == 5000) //{ // getThumbnail.jtk = 4; //} //if (blc == 10000) //{ // getThumbnail.jtk = 8; //} //if (blc == 20000) //{ // getThumbnail.jtk = 16; //} #endregion getthumbnail.openDwg(textBox_files.Text, textBox_tk.Text, textBox_iplfiles.Text); Properties.Settings.Default.files = textBox_files.Text; Properties.Settings.Default.jtb = textBox_tk.Text; Properties.Settings.Default.svpath = textBox_iplfiles.Text; Properties.Settings.Default.tk = textBox_tkn.Text; Properties.Settings.Default.tfh = textBox_tfh.Text; Properties.Settings.Default.Save(); this.Close(); //getThumbnail getthumbnail = new getThumbnail(); //getThumbnail.bl = 4; //getThumbnail.tc_tfh = "0"; //getThumbnail.tc_tk = "TK"; //getthumbnail.openDwg("F://2022//2022-11//接图表替换//t//1", "F://2022//2022-11//接图表替换//t//新建文件夹//Drawing2.dwg", // "F://2022//2022-11//接图表替换//t"); //getthumbnail.openDwg("F://2022//2022-11//接图表替换//重新套图框/雅砻江牙根二级水电站可研阶段库区地形地类图(含水下)-2000", // "F://2022//2022-11//接图表替换//2000库区分幅结合表-CGCS2000-102.dwg", // "F://2022//2022-11//接图表替换//重新套图框"); } } }