?? form1.cs
字號:
#region refer
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using System.Threading;
using Lucene.Net.Documents;
using Lucene.Net.Index;
using Lucene.Net.Search;
using Lucene.Net.QueryParsers;
using Lucene.Net.Analysis.Cn;
#endregion
namespace LuceneTest
{
/// <summary>
/// Form1 的摘要說明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
#region 控件聲明
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.MenuItem menuItem3;
private System.Windows.Forms.MenuItem menuItem4;
private System.Windows.Forms.MenuItem menuItem5;
private System.Windows.Forms.MenuItem menuItem6;
private System.Windows.Forms.MenuItem menuItem7;
private System.Windows.Forms.MenuItem menuItem8;
private System.Windows.Forms.MenuItem menuItem9;
private System.Windows.Forms.MenuItem menuItem10;
private System.Windows.Forms.MenuItem menuItem11;
private System.Windows.Forms.MenuItem menuItem12;
private System.Windows.Forms.MenuItem menuItem13;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1;
private System.Windows.Forms.StatusBar statusBar1;
private System.Windows.Forms.ContextMenu contextMenu1;
private System.Windows.Forms.MenuItem menuItem14;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
#endregion
#region 字段
const string INDEX_STORE_PATH = "index";
IndexSearcher searcher = null;
DateTime start = DateTime.Now;
#endregion
#region 自動生成代碼,構(gòu)造函數(shù),Dispose,Main
/// <summary>
/// 必需的設(shè)計器變量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Windows 窗體設(shè)計器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 調(diào)用后添加任何構(gòu)造函數(shù)代碼
//
}
/// <summary>
/// 清理所有正在使用的資源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗體設(shè)計器生成的代碼
/// <summary>
/// 設(shè)計器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內(nèi)容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.label1 = new System.Windows.Forms.Label();
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.menuItem6 = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
this.menuItem7 = new System.Windows.Forms.MenuItem();
this.menuItem8 = new System.Windows.Forms.MenuItem();
this.menuItem9 = new System.Windows.Forms.MenuItem();
this.menuItem4 = new System.Windows.Forms.MenuItem();
this.menuItem10 = new System.Windows.Forms.MenuItem();
this.menuItem11 = new System.Windows.Forms.MenuItem();
this.menuItem5 = new System.Windows.Forms.MenuItem();
this.menuItem12 = new System.Windows.Forms.MenuItem();
this.menuItem13 = new System.Windows.Forms.MenuItem();
this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
this.statusBar1 = new System.Windows.Forms.StatusBar();
this.contextMenu1 = new System.Windows.Forms.ContextMenu();
this.menuItem14 = new System.Windows.Forms.MenuItem();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Location = new System.Drawing.Point(8, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(488, 272);
this.tabControl1.TabIndex = 0;
//
// tabPage1
//
this.tabPage1.BackColor = System.Drawing.SystemColors.Control;
this.tabPage1.Controls.Add(this.richTextBox1);
this.tabPage1.Controls.Add(this.textBox1);
this.tabPage1.Controls.Add(this.button2);
this.tabPage1.Controls.Add(this.button1);
this.tabPage1.Location = new System.Drawing.Point(4, 21);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Size = new System.Drawing.Size(480, 247);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "簡單測試";
//
// richTextBox1
//
this.richTextBox1.ContextMenu = this.contextMenu1;
this.richTextBox1.Location = new System.Drawing.Point(8, 40);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(464, 200);
this.richTextBox1.TabIndex = 4;
this.richTextBox1.Text = "";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(272, 10);
this.textBox1.Name = "textBox1";
this.textBox1.TabIndex = 3;
this.textBox1.Text = "請輸入關(guān)鍵字";
this.textBox1.Enter += new System.EventHandler(this.textBox1_Enter);
//
// button2
//
this.button2.Location = new System.Drawing.Point(392, 8);
this.button2.Name = "button2";
this.button2.TabIndex = 2;
this.button2.Text = "搜索";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(8, 8);
this.button1.Name = "button1";
this.button1.TabIndex = 1;
this.button1.Text = "建立索引";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// tabPage2
//
this.tabPage2.Controls.Add(this.label3);
this.tabPage2.Controls.Add(this.label2);
this.tabPage2.Controls.Add(this.pictureBox2);
this.tabPage2.Controls.Add(this.pictureBox1);
this.tabPage2.Controls.Add(this.label1);
this.tabPage2.Location = new System.Drawing.Point(4, 21);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Size = new System.Drawing.Size(480, 247);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "關(guān)于";
//
// label1
//
this.label1.Location = new System.Drawing.Point(24, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(288, 16);
this.label1.TabIndex = 0;
this.label1.Text = "大家好,我是呱呱,這是我的Lucene.Net測試";
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuItem3,
this.menuItem4,
this.menuItem5});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem2,
this.menuItem6});
this.menuItem1.Text = "文件";
//
// menuItem2
//
this.menuItem2.Index = 0;
this.menuItem2.Text = "打開";
//
// menuItem6
//
this.menuItem6.Index = 1;
this.menuItem6.Text = "關(guān)閉";
//
// menuItem3
//
this.menuItem3.Index = 1;
this.menuItem3.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem7,
this.menuItem8,
this.menuItem9});
this.menuItem3.Text = "編輯";
//
// menuItem7
//
this.menuItem7.Index = 0;
this.menuItem7.Text = "剪切";
//
// menuItem8
//
this.menuItem8.Index = 1;
this.menuItem8.Text = "復(fù)制";
//
// menuItem9
//
this.menuItem9.Index = 2;
this.menuItem9.Text = "粘貼";
//
// menuItem4
//
this.menuItem4.Index = 2;
this.menuItem4.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem10,
this.menuItem11});
this.menuItem4.Text = "窗口";
//
// menuItem10
//
this.menuItem10.Index = 0;
this.menuItem10.Text = "平鋪";
//
// menuItem11
//
this.menuItem11.Index = 1;
this.menuItem11.Text = "最小化";
//
// menuItem5
//
this.menuItem5.Index = 3;
this.menuItem5.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem12,
this.menuItem13});
this.menuItem5.Text = "幫助";
//
// menuItem12
//
this.menuItem12.Index = 0;
this.menuItem12.Text = "幫助文檔";
//
// menuItem13
//
this.menuItem13.Index = 1;
this.menuItem13.Text = "關(guān)于";
//
// statusBar1
//
this.statusBar1.Location = new System.Drawing.Point(0, 293);
this.statusBar1.Name = "statusBar1";
this.statusBar1.Size = new System.Drawing.Size(504, 22);
this.statusBar1.TabIndex = 1;
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -