先来展示下做到了什么?
首先要导入一个文件夹下的所有文件,要不你怎么操作呢?或者,如果本地有xml文档,可以加载xml文档内容。
图片上的描述已经够看了,我就不费事在这里多写些什么了。
我又仔细的看了一下,貌似也不需要语言上解释什么了,唉,那就这样吧。
================================================================================================
昨天花了三四个小时做的,今天又简单的修改了一下,希望会有人喜欢。
XMLHelper 和 TextHelper 几乎可以说是万能通用工具。
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Xml; 6 7 namespace 文章操作工具 8 { 9 public class XMLHelper 10 { 11 public static void SerializeToXml<T>(string filePath, T obj) 12 { 13 using (System.IO.StreamWriter writer = new System.IO.StreamWriter(filePath)) 14 { 15 System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(typeof(T)); 16 xs.Serialize(writer, obj); 17 } 18 } 19 20 public static T DeserializeFromXml<T>(string filePath) 21 { 22 if (!System.IO.File.Exists(filePath)) 23 throw new ArgumentNullException(filePath + " not Exists"); 24 25 using (System.IO.StreamReader reader = new System.IO.StreamReader(filePath)) 26 { 27 System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(typeof(T)); 28 return (T)xs.Deserialize(reader); 29 } 30 31 } 32 } 33 }
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.IO; 6 7 namespace 文章操作工具 8 { 9 public class TextHelper 10 { 11 public static System.Text.Encoding GetType(string filename) 12 { 13 FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read); 14 System.Text.Encoding r = GetType(fs); 15 fs.Close(); 16 return r; 17 } 18 19 public static System.Text.Encoding GetType(FileStream fs) 20 { 21 /* 22 Unicode 23 ------------------ 24 255 254 25 26 ====================== 27 UnicodeBigEndian 28 ------------------- 29 254 255 30 31 ====================== 32 UTF8 33 ------------------- 34 34 228 35 34 229 36 34 230 37 34 231 38 34 232 39 34 233 40 239 187 41 42 ====================== 43 ANSI 44 ------------------- 45 34 176 46 34 177 47 34 179 48 34 180 49 34 182 50 34 185 51 34 191 52 34 194 53 34 196 54 34 198 55 34 201 56 34 202 57 34 205 58 34 206 59 34 208 60 34 209 61 34 210 62 34 211 63 34 213 64 196 167 65 202 213 66 206 228 67 */ 68 BinaryReader r = new BinaryReader(fs, System.Text.Encoding.Default); 69 byte[] ss = r.ReadBytes(3); 70 int lef = ss[0]; 71 int mid = ss[1]; 72 int rig = ss[2]; 73 r.Close(); 74 /* 文件头两个字节是255 254,为Unicode编码; 75 文件头三个字节 254 255 0,为UTF-16BE编码; 76 文件头三个字节 239 187 191,为UTF-8编码;*/ 77 if (lef == 255 && mid == 254) 78 { 79 return Encoding.Unicode; 80 } 81 else if (lef == 254 && mid == 255 && rig == 0) 82 { 83 return Encoding.BigEndianUnicode; 84 } 85 else if (lef == 254 && mid == 255) 86 { 87 return Encoding.BigEndianUnicode; 88 } 89 else if (lef == 239 && mid == 187 && rig == 191) 90 { 91 return Encoding.UTF8; 92 } 93 else if (lef == 239 && mid == 187) 94 { 95 return Encoding.UTF8; 96 } 97 else if (lef == 196 && mid == 167 98 || lef == 206 && mid == 228 99 || lef == 202 && mid == 213) 100 { 101 return Encoding.Default; 102 } 103 else 104 { 105 if (lef == 34) 106 { 107 if (mid < 220) return Encoding.Default; 108 else return Encoding.UTF8; 109 } 110 else 111 { 112 if (lef < 220) return Encoding.Default; 113 else return Encoding.UTF8; 114 } 115 } 116 } 117 } 118 }
================================================================================================
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 6 using System.Xml.Serialization; 7 8 namespace 文章操作工具 9 { 10 public class BookInfo 11 { 12 [XmlAttributeAttribute] 13 public long length { set; get; } 14 15 [XmlAttributeAttribute] 16 public string bookname { set; get; } 17 18 //[XmlAttributeAttribute] 19 //public string author { set; get; } 20 21 [XmlAttributeAttribute] 22 public string path { set; get; } 23 24 [XmlAttributeAttribute] 25 public string type { set; get; } 26 public string fullname { get { return path + "/" + bookname; } } 27 } 28 }
================================================================================================
1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Data; 5 using System.Drawing; 6 using System.IO; 7 using System.Linq; 8 using System.Text; 9 using System.Text.RegularExpressions; 10 using System.Threading.Tasks; 11 using System.Windows.Forms; 12 13 namespace 文章操作工具 14 { 15 public partial class frmMain : Form 16 { 17 private List<BookInfo> booklist = new List<BookInfo>(1000); 18 private List<BookInfo> bindlist = new List<BookInfo>(1000); 19 private readonly string xmlName = "BookInfo.XML"; 20 public frmMain() 21 { 22 InitializeComponent(); 23 24 this.dataGridView1.AutoGenerateColumns = false; 25 this.bookname.DataPropertyName = "bookname"; 26 this.path.DataPropertyName = "path"; 27 this.length.DataPropertyName = "length"; 28 this.author.DataPropertyName = "author"; 29 this.type.DataPropertyName = "type"; 30 31 this.txtPageSize.Text = this.pagesize.ToString(); 32 } 33 34 private void btn_Input_Info_Click(object sender, EventArgs e) 35 { 36 ConsoleWriteLine("导入信息 : " + tex_Path.Text + Environment.NewLine, Color.Green); 37 if (Directory.Exists(tex_Path.Text)) 38 { 39 AllButtonEnable(this, false); 40 BackgroundWorker b = new BackgroundWorker(); 41 b.DoWork += (s, ea) => 42 { 43 Cycle(tex_Path.Text); 44 }; 45 b.RunWorkerCompleted += (s, ea) => 46 { 47 AllButtonEnable(this, true); 48 }; 49 b.RunWorkerAsync(); 50 } 51 } 52 53 private void AllButtonEnable(Control pctl, bool enable) { 54 55 tex_Path.Enabled = enable; 56 AllButtonEnable2(pctl, enable); 57 } 58 59 private void AllButtonEnable2(Control pctl, bool enable) 60 { 61 if (pctl is ButtonBase) 62 { 63 pctl.Enabled = enable; 64 } 65 else 66 { 67 foreach (Control ctl in pctl.Controls) 68 { 69 AllButtonEnable2(ctl, enable); 70 } 71 } 72 } 73 74 private void tex_Path_Click(object sender, EventArgs e) 75 { 76 FolderBrowserDialog g = new FolderBrowserDialog(); 77 g.SelectedPath = Directory.GetDirectoryRoot(AppDomain.CurrentDomain.BaseDirectory); 78 g.ShowNewFolderButton = false; 79 if (g.ShowDialog() == System.Windows.Forms.DialogResult.OK) 80 { 81 if (g.SelectedPath != null && Directory.Exists(g.SelectedPath)) 82 { 83 tex_Path.Text = g.SelectedPath; 84 } 85 } 86 } 87 88 private bool Cycle(string path) 89 { 90 int fileCount = 0; 91 int folderCount = 0; 92 93 if (path == null || path == "") 94 { 95 return false; 96 } 97 98 string[] files = null; 99 try 100 { 101 files = Directory.GetFiles(path); 102 } 103 catch (Exception ex) 104 { 105 ConsoleWriteLine("Directory.GetFiles(" + path + ") Exception : " + ex.StackTrace + Environment.NewLine, Color.Red); 106 } 107 108 if (files != null && (fileCount = files.Length) > 0) 109 { 110 foreach (string file in files) 111 { 112 try 113 { 114 FileInfo fi = new FileInfo(file); 115 if (fi.Length == 0) 116 { 117 ConsoleWriteLine("delete 0 size file : " + fi.FullName + Environment.NewLine); 118 fi.Attributes = fi.Attributes & ~(FileAttributes.Archive | FileAttributes.ReadOnly | FileAttributes.Hidden); 119 fi.Delete(); 120 fileCount--; 121 } 122 else 123 { 124 BookInfo info = new BookInfo 125 { 126 bookname = fi.Name, 127 path = fi.DirectoryName, 128 length = fi.Length, 129 type = fi.Extension 130 }; 131 this.booklist.Add(info); 132 } 133 } 134 catch (Exception ex) 135 { 136 ConsoleWriteLine("FileInfo.Delete(" + file + ") Exception : " + ex.StackTrace + Environment.NewLine, Color.Red); 137 } 138 } 139 } 140 141 string[] folders = null; 142 try 143 { 144 folders = Directory.GetDirectories(path); 145 } 146 catch (Exception ex) 147 { 148 ConsoleWriteLine("Directory.GetDirectories(" + path + ") Exception : " + ex.StackTrace + Environment.NewLine, Color.Red); 149 } 150 151 if (folders != null && (folderCount = folders.Length) > 0) 152 { 153 foreach (string folder in folders) 154 { 155 if (Cycle(folder)) 156 { 157 try 158 { 159 DirectoryInfo di = new DirectoryInfo(folder); 160 ConsoleWriteLine("delete Empty path " + di.FullName + Environment.NewLine); 161 di.Attributes = di.Attributes & ~(FileAttributes.Archive | FileAttributes.ReadOnly | FileAttributes.Hidden); 162 di.Delete(); 163 folderCount--; 164 } 165 catch (Exception ex) 166 { 167 ConsoleWriteLine("DirectoryInfo.Delete(" + path + ") Exception : " + ex.StackTrace + Environment.NewLine, Color.Red); 168 } 169 } 170 } 171 } 172 173 //ConsoleWriteLine("搜索 " + path + " 完毕" + Environment.NewLine); 174 return (folderCount <= 0 && fileCount <= 0); 175 } 176 177 private void ConsoleWriteLine(string msg) 178 { 179 if (!rtx_show.InvokeRequired) 180 { 181 rtx_show.AppendText(msg); 182 rtx_show.ScrollToCaret(); 183 } 184 else 185 { 186 rtx_show.Invoke(new MethodInvoker(delegate { ConsoleWriteLine(msg); })); 187 } 188 } 189 190 private void ConsoleWriteLine(string msg, Color cc) 191 { 192 if (!rtx_show.InvokeRequired) 193 { 194 var v = rtx_show.ForeColor; 195 rtx_show.ForeColor = cc; 196 rtx_show.AppendText(msg); 197 rtx_show.ForeColor = v; 198 rtx_show.ScrollToCaret(); 199 } 200 else 201 { 202 rtx_show.Invoke(new MethodInvoker(delegate { ConsoleWriteLine(msg, cc); })); 203 } 204 } 205 206 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) 207 { 208 DataGridView dgv = (DataGridView)sender; 209 210 if (dgv.Columns[e.ColumnIndex].Name == "delete") 211 { 212 try 213 { 214 if (MessageBox.Show("确认要删除吗?", "警告", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK) 215 { 216 BookInfo info = (BookInfo)dgv.Rows[e.RowIndex].DataBoundItem; 217 string fullname = info.fullname; 218 this.booklist.Remove(info); 219 this.bindlist.Remove(info); 220 bindData(); 221 FileInfo fi = new FileInfo(fullname); 222 fi.Attributes = fi.Attributes & ~(FileAttributes.Archive | FileAttributes.ReadOnly | FileAttributes.Hidden); 223 fi.Delete(); 224 ConsoleWriteLine("delete file : " + fullname + Environment.NewLine, Color.Green); 225 } 226 } 227 catch (Exception ex) 228 { 229 ConsoleWriteLine("FileInfo.Delete(" + bookname + ") Exception : " + ex.StackTrace + Environment.NewLine, Color.Red); 230 } 231 } 232 233 if (dgv.Columns[e.ColumnIndex].Name == "load") 234 { 235 try 236 { 237 BookInfo info = (BookInfo)dgv.Rows[e.RowIndex].DataBoundItem; 238 string fullname = info.fullname; 239 if (isLeft) 240 { 241 textBox1.Text = File.ReadAllText(fullname, TextHelper.GetType(fullname)); 242 } 243 else 244 { 245 textBox2.Text = File.ReadAllText(fullname, TextHelper.GetType(fullname)); 246 } 247 isLeft = !isLeft; 248 ConsoleWriteLine("load file : " + fullname + Environment.NewLine, Color.Green); 249 } 250 catch (Exception ex) 251 { 252 ConsoleWriteLine("FileInfo.Delete(" + bookname + ") Exception : " + ex.StackTrace + Environment.NewLine, Color.Red); 253 } 254 } 255 } 256 257 private bool isLeft = true; 258 259 private void btnSearch_Click(object sender, EventArgs e) 260 { 261 AllButtonEnable(this, false); 262 string bookname = txtName.Text; 263 ConsoleWriteLine("search file : " + bookname + Environment.NewLine, Color.Green); 264 try 265 { 266 if (!string.IsNullOrEmpty(bookname)) 267 { 268 this.bindlist = this.booklist.FindAll((i) => { return i.bookname.Contains(bookname); }); 269 } 270 else 271 { 272 this.bindlist = this.booklist; 273 } 274 275 this.curpage = 1; 276 bindData(); 277 } 278 catch (Exception ex) 279 { 280 ConsoleWriteLine("Search(" + bookname + ") Exception : " + ex.StackTrace + Environment.NewLine, Color.Red); 281 } 282 finally 283 { 284 AllButtonEnable(this, true); 285 } 286 } 287 288 private void btn_sort_length_Click(object sender, EventArgs e) 289 { 290 AllButtonEnable(this, false); 291 ConsoleWriteLine("文件大小排序" + Environment.NewLine, Color.Green); 292 this.bindlist.Sort((a, b) => 293 { 294 return (int)(a.length - b.length); 295 }); 296 AllButtonEnable(this, true); 297 this.curpage = 1; 298 bindData(); 299 } 300 301 private void btn_name_like_Click(object sender, EventArgs e) 302 { 303 AllButtonEnable(this, false); 304 ConsoleWriteLine("书名相似度排序" + Environment.NewLine, Color.Green); 305 this.bindlist.Sort((a, b) => 306 { 307 string aname = a.bookname; 308 string bname = b.bookname; 309 int same = 0; 310 for (int i = 0; i < aname.Length; i++) 311 { 312 if (bname.Contains(aname[i])) 313 { 314 same++; 315 } 316 } 317 return (int)((same * same) / (aname.Length * bname.Length)); 318 }); 319 AllButtonEnable(this, true); 320 this.curpage = 1; 321 bindData(); 322 } 323 324 private void btn_name_Click(object sender, EventArgs e) 325 { 326 AllButtonEnable(this, false); 327 ConsoleWriteLine("书名排序" + Environment.NewLine, Color.Green); 328 this.bindlist.Sort((a, b) => 329 { 330 return string.CompareOrdinal(a.bookname, b.bookname); 331 }); 332 AllButtonEnable(this, true); 333 this.curpage = 1; 334 bindData(); 335 } 336 337 private void splitContainer1_SizeChanged(object sender, EventArgs e) 338 { 339 340 } 341 342 private void btn_loadFromXML_Click(object sender, EventArgs e) 343 { 344 try 345 { 346 AllButtonEnable(this, false); 347 this.booklist = XMLHelper.DeserializeFromXml<List<BookInfo>>(xmlName); 348 } 349 catch (Exception ex) 350 { 351 ConsoleWriteLine("load xml Exception : " + ex.StackTrace + Environment.NewLine, Color.Red); 352 } 353 finally 354 { 355 AllButtonEnable(this, true); 356 } 357 } 358 359 private void frmMain_FormClosing(object sender, FormClosingEventArgs e) 360 { 361 try 362 { 363 XMLHelper.SerializeToXml<List<BookInfo>>(xmlName, this.booklist); 364 } 365 catch (Exception ex) 366 { 367 ConsoleWriteLine("save xml Exception : " + ex.StackTrace + Environment.NewLine, Color.Red); 368 } 369 } 370 371 private int curpage = 1; 372 private int pagesize = 50; 373 private int datatotal = 0; 374 375 private void bindData() 376 { 377 datatotal = this.bindlist.Count; 378 int index = (curpage - 1) * pagesize; 379 this.lpage.Text = curpage + "/" + (datatotal / pagesize + (datatotal % pagesize == 0 ? 0 : 1)); 380 dataGridView1.DataSource = this.bindlist.GetRange(index, Math.Min(pagesize, datatotal - index)); 381 dataGridView1.Refresh(); 382 } 383 384 private void btnNext_Click(object sender, EventArgs e) 385 { 386 if (curpage < (datatotal / pagesize + (datatotal % pagesize == 0 ? 0 : 1))) 387 { 388 curpage++; 389 bindData(); 390 } 391 } 392 393 private void btnPre_Click(object sender, EventArgs e) 394 { 395 if (curpage > 1) 396 { 397 curpage--; 398 bindData(); 399 } 400 } 401 402 private void btnSetPageSize_Click(object sender, EventArgs e) 403 { 404 405 Regex reg = new Regex("\d+"); 406 if (reg.IsMatch(this.txtPageSize.Text.Trim())) 407 { 408 int size = 0; 409 if (int.TryParse(this.txtPageSize.Text.Trim(), out size)) 410 { 411 if (size <= 0) 412 { 413 this.pagesize = 1; 414 } 415 else 416 { 417 this.pagesize = size; 418 } 419 } 420 else 421 { 422 this.pagesize = int.MaxValue; 423 } 424 425 this.txtPageSize.Text = this.pagesize.ToString(); 426 } 427 } 428 } 429 }
设计器自动生成,frmMain的设计器文件
1 namespace 文章操作工具 2 { 3 partial class frmMain 4 { 5 /// <summary> 6 /// Required designer variable. 7 /// </summary> 8 private System.ComponentModel.IContainer components = null; 9 10 /// <summary> 11 /// Clean up any resources being used. 12 /// </summary> 13 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> 14 protected override void Dispose(bool disposing) 15 { 16 if (disposing && (components != null)) 17 { 18 components.Dispose(); 19 } 20 base.Dispose(disposing); 21 } 22 23 #region Windows Form Designer generated code 24 25 /// <summary> 26 /// Required method for Designer support - do not modify 27 /// the contents of this method with the code editor. 28 /// </summary> 29 private void InitializeComponent() 30 { 31 this.tabControl1 = new System.Windows.Forms.TabControl(); 32 this.tabPage1 = new System.Windows.Forms.TabPage(); 33 this.btnSetPageSize = new System.Windows.Forms.Button(); 34 this.txtPageSize = new System.Windows.Forms.TextBox(); 35 this.btn_loadFromXML = new System.Windows.Forms.Button(); 36 this.tex_Path = new System.Windows.Forms.TextBox(); 37 this.btn_Input_Info = new System.Windows.Forms.Button(); 38 this.tabPage2 = new System.Windows.Forms.TabPage(); 39 this.lpage = new System.Windows.Forms.Label(); 40 this.btnNext = new System.Windows.Forms.Button(); 41 this.btnPre = new System.Windows.Forms.Button(); 42 this.btn_name = new System.Windows.Forms.Button(); 43 this.splitContainer1 = new System.Windows.Forms.SplitContainer(); 44 this.textBox1 = new System.Windows.Forms.TextBox(); 45 this.textBox2 = new System.Windows.Forms.TextBox(); 46 this.btnSearch = new System.Windows.Forms.Button(); 47 this.btn_name_like = new System.Windows.Forms.Button(); 48 this.btn_sort_length = new System.Windows.Forms.Button(); 49 this.txtName = new System.Windows.Forms.TextBox(); 50 this.dataGridView1 = new System.Windows.Forms.DataGridView(); 51 this.delete = new System.Windows.Forms.DataGridViewButtonColumn(); 52 this.load = new System.Windows.Forms.DataGridViewButtonColumn(); 53 this.bookname = new System.Windows.Forms.DataGridViewTextBoxColumn(); 54 this.author = new System.Windows.Forms.DataGridViewTextBoxColumn(); 55 this.path = new System.Windows.Forms.DataGridViewTextBoxColumn(); 56 this.length = new System.Windows.Forms.DataGridViewTextBoxColumn(); 57 this.type = new System.Windows.Forms.DataGridViewTextBoxColumn(); 58 this.tabPage3 = new System.Windows.Forms.TabPage(); 59 this.rtx_show = new System.Windows.Forms.RichTextBox(); 60 this.tabControl1.SuspendLayout(); 61 this.tabPage1.SuspendLayout(); 62 this.tabPage2.SuspendLayout(); 63 ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); 64 this.splitContainer1.Panel1.SuspendLayout(); 65 this.splitContainer1.Panel2.SuspendLayout(); 66 this.splitContainer1.SuspendLayout(); 67 ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); 68 this.SuspendLayout(); 69 // 70 // tabControl1 71 // 72 this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 73 | System.Windows.Forms.AnchorStyles.Left) 74 | System.Windows.Forms.AnchorStyles.Right))); 75 this.tabControl1.Controls.Add(this.tabPage1); 76 this.tabControl1.Controls.Add(this.tabPage2); 77 this.tabControl1.Controls.Add(this.tabPage3); 78 this.tabControl1.Location = new System.Drawing.Point(0, 0); 79 this.tabControl1.Name = "tabControl1"; 80 this.tabControl1.SelectedIndex = 0; 81 this.tabControl1.Size = new System.Drawing.Size(679, 415); 82 this.tabControl1.TabIndex = 0; 83 // 84 // tabPage1 85 // 86 this.tabPage1.Controls.Add(this.btnSetPageSize); 87 this.tabPage1.Controls.Add(this.txtPageSize); 88 this.tabPage1.Controls.Add(this.btn_loadFromXML); 89 this.tabPage1.Controls.Add(this.tex_Path); 90 this.tabPage1.Controls.Add(this.btn_Input_Info); 91 this.tabPage1.Location = new System.Drawing.Point(4, 22); 92 this.tabPage1.Name = "tabPage1"; 93 this.tabPage1.Padding = new System.Windows.Forms.Padding(3); 94 this.tabPage1.Size = new System.Drawing.Size(671, 389); 95 this.tabPage1.TabIndex = 0; 96 this.tabPage1.Text = "加载"; 97 this.tabPage1.UseVisualStyleBackColor = true; 98 // 99 // btnSetPageSize 100 // 101 this.btnSetPageSize.Location = new System.Drawing.Point(120, 52); 102 this.btnSetPageSize.Name = "btnSetPageSize"; 103 this.btnSetPageSize.Size = new System.Drawing.Size(98, 23); 104 this.btnSetPageSize.TabIndex = 7; 105 this.btnSetPageSize.Text = "设置每页大小"; 106 this.btnSetPageSize.UseVisualStyleBackColor = true; 107 this.btnSetPageSize.Click += new System.EventHandler(this.btnSetPageSize_Click); 108 // 109 // txtPageSize 110 // 111 this.txtPageSize.Location = new System.Drawing.Point(15, 53); 112 this.txtPageSize.Name = "txtPageSize"; 113 this.txtPageSize.Size = new System.Drawing.Size(100, 21); 114 this.txtPageSize.TabIndex = 6; 115 // 116 // btn_loadFromXML 117 // 118 this.btn_loadFromXML.AutoSize = true; 119 this.btn_loadFromXML.Location = new System.Drawing.Point(539, 15); 120 this.btn_loadFromXML.Name = "btn_loadFromXML"; 121 this.btn_loadFromXML.Size = new System.Drawing.Size(105, 23); 122 this.btn_loadFromXML.TabIndex = 5; 123 this.btn_loadFromXML.Text = "本地XML文档加载"; 124 this.btn_loadFromXML.UseVisualStyleBackColor = true; 125 this.btn_loadFromXML.Click += new System.EventHandler(this.btn_loadFromXML_Click); 126 // 127 // tex_Path 128 // 129 this.tex_Path.Location = new System.Drawing.Point(15, 16); 130 this.tex_Path.Name = "tex_Path"; 131 this.tex_Path.Size = new System.Drawing.Size(436, 21); 132 this.tex_Path.TabIndex = 1; 133 this.tex_Path.Click += new System.EventHandler(this.tex_Path_Click); 134 // 135 // btn_Input_Info 136 // 137 this.btn_Input_Info.Location = new System.Drawing.Point(459, 15); 138 this.btn_Input_Info.Name = "btn_Input_Info"; 139 this.btn_Input_Info.Size = new System.Drawing.Size(75, 23); 140 this.btn_Input_Info.TabIndex = 0; 141 this.btn_Input_Info.Text = "导入"; 142 this.btn_Input_Info.UseVisualStyleBackColor = true; 143 this.btn_Input_Info.Click += new System.EventHandler(this.btn_Input_Info_Click); 144 // 145 // tabPage2 146 // 147 this.tabPage2.Controls.Add(this.lpage); 148 this.tabPage2.Controls.Add(this.btnNext); 149 this.tabPage2.Controls.Add(this.btnPre); 150 this.tabPage2.Controls.Add(this.btn_name); 151 this.tabPage2.Controls.Add(this.splitContainer1); 152 this.tabPage2.Controls.Add(this.btnSearch); 153 this.tabPage2.Controls.Add(this.btn_name_like); 154 this.tabPage2.Controls.Add(this.btn_sort_length); 155 this.tabPage2.Controls.Add(this.txtName); 156 this.tabPage2.Controls.Add(this.dataGridView1); 157 this.tabPage2.Location = new System.Drawing.Point(4, 22); 158 this.tabPage2.Name = "tabPage2"; 159 this.tabPage2.Padding = new System.Windows.Forms.Padding(3); 160 this.tabPage2.Size = new System.Drawing.Size(671, 389); 161 this.tabPage2.TabIndex = 1; 162 this.tabPage2.Text = "处理"; 163 this.tabPage2.UseVisualStyleBackColor = true; 164 // 165 // lpage 166 // 167 this.lpage.AutoSize = true; 168 this.lpage.Location = new System.Drawing.Point(517, 7); 169 this.lpage.Name = "lpage"; 170 this.lpage.Size = new System.Drawing.Size(11, 12); 171 this.lpage.TabIndex = 21; 172 this.lpage.Text = "0"; 173 // 174 // btnNext 175 // 176 this.btnNext.AutoSize = true; 177 this.btnNext.Location = new System.Drawing.Point(617, 1); 178 this.btnNext.Name = "btnNext"; 179 this.btnNext.Size = new System.Drawing.Size(51, 23); 180 this.btnNext.TabIndex = 20; 181 this.btnNext.Text = "Next>>"; 182 this.btnNext.UseVisualStyleBackColor = true; 183 this.btnNext.Click += new System.EventHandler(this.btnNext_Click); 184 // 185 // btnPre 186 // 187 this.btnPre.AutoSize = true; 188 this.btnPre.Location = new System.Drawing.Point(567, 1); 189 this.btnPre.Name = "btnPre"; 190 this.btnPre.Size = new System.Drawing.Size(45, 23); 191 this.btnPre.TabIndex = 19; 192 this.btnPre.Text = "<<Pre"; 193 this.btnPre.UseVisualStyleBackColor = true; 194 this.btnPre.Click += new System.EventHandler(this.btnPre_Click); 195 // 196 // btn_name 197 // 198 this.btn_name.AutoSize = true; 199 this.btn_name.Location = new System.Drawing.Point(391, 1); 200 this.btn_name.Name = "btn_name"; 201 this.btn_name.Size = new System.Drawing.Size(87, 23); 202 this.btn_name.TabIndex = 4; 203 this.btn_name.Text = "书名排序"; 204 this.btn_name.UseVisualStyleBackColor = true; 205 this.btn_name.Click += new System.EventHandler(this.btn_name_Click); 206 // 207 // splitContainer1 208 // 209 this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 210 | System.Windows.Forms.AnchorStyles.Right))); 211 this.splitContainer1.Location = new System.Drawing.Point(3, 216); 212 this.splitContainer1.Name = "splitContainer1"; 213 // 214 // splitContainer1.Panel1 215 // 216 this.splitContainer1.Panel1.Controls.Add(this.textBox1); 217 this.splitContainer1.Panel1.RightToLeft = System.Windows.Forms.RightToLeft.No; 218 this.splitContainer1.Panel1MinSize = 0; 219 // 220 // splitContainer1.Panel2 221 // 222 this.splitContainer1.Panel2.Controls.Add(this.textBox2); 223 this.splitContainer1.Panel2.RightToLeft = System.Windows.Forms.RightToLeft.No; 224 this.splitContainer1.Panel2MinSize = 0; 225 this.splitContainer1.Size = new System.Drawing.Size(665, 173); 226 this.splitContainer1.SplitterDistance = 327; 227 this.splitContainer1.SplitterWidth = 1; 228 this.splitContainer1.TabIndex = 18; 229 this.splitContainer1.SizeChanged += new System.EventHandler(this.splitContainer1_SizeChanged); 230 // 231 // textBox1 232 // 233 this.textBox1.AllowDrop = true; 234 this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill; 235 this.textBox1.Location = new System.Drawing.Point(0, 0); 236 this.textBox1.Multiline = true; 237 this.textBox1.Name = "textBox1"; 238 this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both; 239 this.textBox1.Size = new System.Drawing.Size(327, 173); 240 this.textBox1.TabIndex = 14; 241 // 242 // textBox2 243 // 244 this.textBox2.AllowDrop = true; 245 this.textBox2.Dock = System.Windows.Forms.DockStyle.Fill; 246 this.textBox2.Location = new System.Drawing.Point(0, 0); 247 this.textBox2.Multiline = true; 248 this.textBox2.Name = "textBox2"; 249 this.textBox2.ScrollBars = System.Windows.Forms.ScrollBars.Both; 250 this.textBox2.Size = new System.Drawing.Size(337, 173); 251 this.textBox2.TabIndex = 15; 252 // 253 // btnSearch 254 // 255 this.btnSearch.Location = new System.Drawing.Point(170, 1); 256 this.btnSearch.Name = "btnSearch"; 257 this.btnSearch.Size = new System.Drawing.Size(43, 23); 258 this.btnSearch.TabIndex = 17; 259 this.btnSearch.Text = "搜索"; 260 this.btnSearch.UseVisualStyleBackColor = true; 261 this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click); 262 // 263 // btn_name_like 264 // 265 this.btn_name_like.AutoSize = true; 266 this.btn_name_like.Location = new System.Drawing.Point(303, 1); 267 this.btn_name_like.Name = "btn_name_like"; 268 this.btn_name_like.Size = new System.Drawing.Size(87, 23); 269 this.btn_name_like.TabIndex = 3; 270 this.btn_name_like.Text = "名称相似"; 271 this.btn_name_like.UseVisualStyleBackColor = true; 272 this.btn_name_like.Click += new System.EventHandler(this.btn_name_like_Click); 273 // 274 // btn_sort_length 275 // 276 this.btn_sort_length.AutoSize = true; 277 this.btn_sort_length.Location = new System.Drawing.Point(215, 1); 278 this.btn_sort_length.Name = "btn_sort_length"; 279 this.btn_sort_length.Size = new System.Drawing.Size(87, 23); 280 this.btn_sort_length.TabIndex = 2; 281 this.btn_sort_length.Text = "大小排序"; 282 this.btn_sort_length.UseVisualStyleBackColor = true; 283 this.btn_sort_length.Click += new System.EventHandler(this.btn_sort_length_Click); 284 // 285 // txtName 286 // 287 this.txtName.Location = new System.Drawing.Point(3, 3); 288 this.txtName.Name = "txtName"; 289 this.txtName.Size = new System.Drawing.Size(161, 21); 290 this.txtName.TabIndex = 16; 291 // 292 // dataGridView1 293 // 294 this.dataGridView1.AllowUserToAddRows = false; 295 this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 296 | System.Windows.Forms.AnchorStyles.Left) 297 | System.Windows.Forms.AnchorStyles.Right))); 298 this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; 299 this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.Window; 300 this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { 301 this.delete, 302 this.load, 303 this.bookname, 304 this.author, 305 this.path, 306 this.length, 307 this.type}); 308 this.dataGridView1.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter; 309 this.dataGridView1.Location = new System.Drawing.Point(3, 25); 310 this.dataGridView1.Margin = new System.Windows.Forms.Padding(0); 311 this.dataGridView1.MultiSelect = false; 312 this.dataGridView1.Name = "dataGridView1"; 313 this.dataGridView1.RowTemplate.Height = 23; 314 this.dataGridView1.Size = new System.Drawing.Size(665, 188); 315 this.dataGridView1.TabIndex = 11; 316 this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick); 317 // 318 // delete 319 // 320 this.delete.HeaderText = "删除"; 321 this.delete.Name = "delete"; 322 this.delete.Text = "删除"; 323 this.delete.UseColumnTextForButtonValue = true; 324 // 325 // load 326 // 327 this.load.HeaderText = "加载"; 328 this.load.Name = "load"; 329 this.load.Text = "加载"; 330 this.load.UseColumnTextForButtonValue = true; 331 // 332 // bookname 333 // 334 this.bookname.HeaderText = "书名"; 335 this.bookname.Name = "bookname"; 336 this.bookname.ReadOnly = true; 337 // 338 // author 339 // 340 this.author.HeaderText = "作者"; 341 this.author.Name = "author"; 342 this.author.ReadOnly = true; 343 this.author.Visible = false; 344 // 345 // path 346 // 347 this.path.HeaderText = "路径"; 348 this.path.Name = "path"; 349 this.path.ReadOnly = true; 350 // 351 // length 352 // 353 this.length.HeaderText = "大小"; 354 this.length.Name = "length"; 355 this.length.ReadOnly = true; 356 // 357 // type 358 // 359 this.type.HeaderText = "后缀"; 360 this.type.Name = "type"; 361 this.type.ReadOnly = true; 362 // 363 // tabPage3 364 // 365 this.tabPage3.Location = new System.Drawing.Point(4, 22); 366 this.tabPage3.Name = "tabPage3"; 367 this.tabPage3.Padding = new System.Windows.Forms.Padding(3); 368 this.tabPage3.Size = new System.Drawing.Size(625, 389); 369 this.tabPage3.TabIndex = 2; 370 this.tabPage3.Text = "人工智能"; 371 this.tabPage3.UseVisualStyleBackColor = true; 372 // 373 // rtx_show 374 // 375 this.rtx_show.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 376 | System.Windows.Forms.AnchorStyles.Right))); 377 this.rtx_show.Location = new System.Drawing.Point(5, 413); 378 this.rtx_show.Name = "rtx_show"; 379 this.rtx_show.Size = new System.Drawing.Size(671, 158); 380 this.rtx_show.TabIndex = 2; 381 this.rtx_show.Text = ""; 382 // 383 // frmMain 384 // 385 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 386 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 387 this.ClientSize = new System.Drawing.Size(684, 575); 388 this.Controls.Add(this.rtx_show); 389 this.Controls.Add(this.tabControl1); 390 this.Name = "frmMain"; 391 this.Text = "frmMain"; 392 this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmMain_FormClosing); 393 this.tabControl1.ResumeLayout(false); 394 this.tabPage1.ResumeLayout(false); 395 this.tabPage1.PerformLayout(); 396 this.tabPage2.ResumeLayout(false); 397 this.tabPage2.PerformLayout(); 398 this.splitContainer1.Panel1.ResumeLayout(false); 399 this.splitContainer1.Panel1.PerformLayout(); 400 this.splitContainer1.Panel2.ResumeLayout(false); 401 this.splitContainer1.Panel2.PerformLayout(); 402 ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); 403 this.splitContainer1.ResumeLayout(false); 404 ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); 405 this.ResumeLayout(false); 406 407 } 408 409 #endregion 410 411 private System.Windows.Forms.TabControl tabControl1; 412 private System.Windows.Forms.TabPage tabPage1; 413 private System.Windows.Forms.TabPage tabPage2; 414 private System.Windows.Forms.TextBox tex_Path; 415 private System.Windows.Forms.Button btn_Input_Info; 416 private System.Windows.Forms.RichTextBox rtx_show; 417 private System.Windows.Forms.DataGridView dataGridView1; 418 private System.Windows.Forms.TextBox textBox2; 419 private System.Windows.Forms.TextBox textBox1; 420 private System.Windows.Forms.TextBox txtName; 421 private System.Windows.Forms.Button btnSearch; 422 private System.Windows.Forms.TabPage tabPage3; 423 private System.Windows.Forms.Button btn_sort_length; 424 private System.Windows.Forms.Button btn_name_like; 425 private System.Windows.Forms.Button btn_name; 426 private System.Windows.Forms.SplitContainer splitContainer1; 427 private System.Windows.Forms.DataGridViewButtonColumn delete; 428 private System.Windows.Forms.DataGridViewButtonColumn load; 429 private System.Windows.Forms.DataGridViewTextBoxColumn bookname; 430 private System.Windows.Forms.DataGridViewTextBoxColumn author; 431 private System.Windows.Forms.DataGridViewTextBoxColumn path; 432 private System.Windows.Forms.DataGridViewTextBoxColumn length; 433 private System.Windows.Forms.DataGridViewTextBoxColumn type; 434 private System.Windows.Forms.Button btn_loadFromXML; 435 private System.Windows.Forms.Label lpage; 436 private System.Windows.Forms.Button btnNext; 437 private System.Windows.Forms.Button btnPre; 438 private System.Windows.Forms.Button btnSetPageSize; 439 private System.Windows.Forms.TextBox txtPageSize; 440 } 441 }
================================================================================================
源代码百度网盘下载: http://pan.baidu.com/s/1kUQrVQv