📄 seach.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace CSDN
{
/// <summary>
/// seach 的摘要说明。
/// </summary>
public class seach : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.DateTimePicker dateTimePicker1;
private System.Windows.Forms.DateTimePicker dateTimePicker2;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.RadioButton radioButton3;
private System.Windows.Forms.RadioButton radioButton4;
private System.Windows.Forms.RadioButton radioButton5;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.RadioButton radioButton6;
private System.Windows.Forms.RadioButton radioButton7;
private System.Windows.Forms.Label label4;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public seach()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.dateTimePicker2 = new System.Windows.Forms.DateTimePicker();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.radioButton5 = new System.Windows.Forms.RadioButton();
this.radioButton4 = new System.Windows.Forms.RadioButton();
this.radioButton3 = new System.Windows.Forms.RadioButton();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.radioButton6 = new System.Windows.Forms.RadioButton();
this.radioButton7 = new System.Windows.Forms.RadioButton();
this.label4 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox4.SuspendLayout();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(144, 320);
this.button1.Name = "button1";
this.button1.TabIndex = 1;
this.button1.Text = "确定";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(16, 40);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(112, 21);
this.textBox1.TabIndex = 0;
this.textBox1.Text = "";
//
// label1
//
this.label1.Location = new System.Drawing.Point(16, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(112, 16);
this.label1.TabIndex = 4;
this.label1.Text = "请输入关键字:";
//
// groupBox1
//
this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {
this.dateTimePicker2,
this.label3,
this.label2,
this.dateTimePicker1});
this.groupBox1.Location = new System.Drawing.Point(144, 80);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(216, 152);
this.groupBox1.TabIndex = 7;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "时间限制";
//
// dateTimePicker2
//
this.dateTimePicker2.Location = new System.Drawing.Point(8, 112);
this.dateTimePicker2.Name = "dateTimePicker2";
this.dateTimePicker2.TabIndex = 10;
//
// label3
//
this.label3.Location = new System.Drawing.Point(16, 88);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(100, 16);
this.label3.TabIndex = 9;
this.label3.Text = "至";
//
// label2
//
this.label2.Location = new System.Drawing.Point(16, 24);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(100, 16);
this.label2.TabIndex = 8;
this.label2.Text = "从";
//
// dateTimePicker1
//
this.dateTimePicker1.Location = new System.Drawing.Point(8, 48);
this.dateTimePicker1.Name = "dateTimePicker1";
this.dateTimePicker1.TabIndex = 7;
this.dateTimePicker1.ValueChanged += new System.EventHandler(this.dateTimePicker1_ValueChanged);
//
// groupBox2
//
this.groupBox2.Controls.AddRange(new System.Windows.Forms.Control[] {
this.radioButton1,
this.radioButton2});
this.groupBox2.Location = new System.Drawing.Point(16, 80);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(112, 72);
this.groupBox2.TabIndex = 8;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "搜索范围";
//
// radioButton1
//
this.radioButton1.Checked = true;
this.radioButton1.Location = new System.Drawing.Point(16, 16);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(72, 24);
this.radioButton1.TabIndex = 7;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "当前论坛";
//
// radioButton2
//
this.radioButton2.Location = new System.Drawing.Point(16, 40);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(72, 24);
this.radioButton2.TabIndex = 8;
this.radioButton2.Text = "所有论坛";
//
// groupBox3
//
this.groupBox3.Controls.AddRange(new System.Windows.Forms.Control[] {
this.radioButton5,
this.radioButton4,
this.radioButton3});
this.groupBox3.Location = new System.Drawing.Point(144, 16);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(216, 48);
this.groupBox3.TabIndex = 9;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "搜索类型";
//
// radioButton5
//
this.radioButton5.Location = new System.Drawing.Point(152, 16);
this.radioButton5.Name = "radioButton5";
this.radioButton5.Size = new System.Drawing.Size(48, 24);
this.radioButton5.TabIndex = 2;
this.radioButton5.Text = "作者";
//
// radioButton4
//
this.radioButton4.Location = new System.Drawing.Point(88, 16);
this.radioButton4.Name = "radioButton4";
this.radioButton4.Size = new System.Drawing.Size(48, 24);
this.radioButton4.TabIndex = 1;
this.radioButton4.Text = "全文";
//
// radioButton3
//
this.radioButton3.Checked = true;
this.radioButton3.Location = new System.Drawing.Point(16, 16);
this.radioButton3.Name = "radioButton3";
this.radioButton3.Size = new System.Drawing.Size(48, 24);
this.radioButton3.TabIndex = 0;
this.radioButton3.TabStop = true;
this.radioButton3.Text = "标题";
this.radioButton3.CheckedChanged += new System.EventHandler(this.radioButton3_CheckedChanged);
//
// groupBox4
//
this.groupBox4.Controls.AddRange(new System.Windows.Forms.Control[] {
this.radioButton6,
this.radioButton7});
this.groupBox4.Location = new System.Drawing.Point(16, 160);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(112, 72);
this.groupBox4.TabIndex = 10;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "搜索对象";
//
// radioButton6
//
this.radioButton6.Checked = true;
this.radioButton6.Location = new System.Drawing.Point(16, 16);
this.radioButton6.Name = "radioButton6";
this.radioButton6.Size = new System.Drawing.Size(72, 24);
this.radioButton6.TabIndex = 7;
this.radioButton6.TabStop = true;
this.radioButton6.Text = "仅帖子";
//
// radioButton7
//
this.radioButton7.Enabled = false;
this.radioButton7.Location = new System.Drawing.Point(16, 40);
this.radioButton7.Name = "radioButton7";
this.radioButton7.Size = new System.Drawing.Size(88, 24);
this.radioButton7.TabIndex = 8;
this.radioButton7.Text = "帖子及回复";
//
// label4
//
this.label4.Location = new System.Drawing.Point(16, 240);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(344, 72);
this.label4.TabIndex = 11;
this.label4.Text = "注:\n1.本搜索只能搜索保存在本地的数据。\n2.在进行所有论坛帖子与回复的全文搜索的时候也许会耗费很长时间,请谨慎使用。\n3.为了减少搜索时间,请尽量加大关键字的" +
"长度。";
//
// seach
//
this.AcceptButton = this.button1;
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(370, 352);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.label4,
this.groupBox4,
this.groupBox3,
this.groupBox2,
this.groupBox1,
this.button1,
this.textBox1,
this.label1});
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "seach";
this.ShowInTaskbar = false;
this.Text = "搜索...";
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox4.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void button1_Click(object sender, System.EventArgs e)
{
Close();
}
public void AllForum()
{
this.radioButton1.Checked = false;
this.radioButton1.Enabled = false;
this.radioButton2.Checked = true;
}
private void radioButton3_CheckedChanged(object sender, System.EventArgs e)
{
if(radioButton3.Checked)
{
this.radioButton6.Checked = true;
this.radioButton7.Enabled = false;
}
else
{
this.radioButton7.Enabled = true;
}
}
private void dateTimePicker1_ValueChanged(object sender, System.EventArgs e)
{
}
public string BeginTime
{
get
{
return this.dateTimePicker1.Value.ToString();
}
}
public string EndTime
{
get
{
return this.dateTimePicker2.Value.ToString();
}
}
public bool SeachAll
{
get
{
return radioButton2.Checked;
}
}
public bool SeachReply
{
get
{
return radioButton7.Checked;
}
}
public int SeachType
{
get
{
if(radioButton3.Checked)
return 1;
else if(radioButton4.Checked)
return 2;
else
return 3;
}
}
public string KeyWord
{
get
{
return this.textBox1.Text;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -