From 357bb468e76f8b216572fe8f7b17c841fbd79f19 Mon Sep 17 00:00:00 2001 From: j502647092 Date: Tue, 4 Aug 2015 16:29:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=87=8D=E8=AF=95=E6=AC=A1?= =?UTF-8?q?=E6=95=B0=20=E6=B7=BB=E5=8A=A0=E6=90=9C=E7=B4=A2=E5=BC=95?= =?UTF-8?q?=E6=93=8E=E7=9A=84=E9=80=89=E6=8B=A9...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frm_Main.Designer.cs | 54 ++++++++++++++++++++++++++++++++++++++++---- Frm_Main.cs | 26 ++++++++++++++++++--- 2 files changed, 72 insertions(+), 8 deletions(-) diff --git a/Frm_Main.Designer.cs b/Frm_Main.Designer.cs index 6d9817f..db9aad6 100644 --- a/Frm_Main.Designer.cs +++ b/Frm_Main.Designer.cs @@ -62,6 +62,9 @@ this.clearsearch = new System.Windows.Forms.Button(); this.label2 = new System.Windows.Forms.Label(); this.retry = new System.Windows.Forms.TextBox(); + this.baiducheck = new System.Windows.Forms.CheckBox(); + this.bingcheck = new System.Windows.Forms.CheckBox(); + this.sougoucheck = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.SearchView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ResultView)).BeginInit(); this.SuspendLayout(); @@ -193,7 +196,7 @@ // // max // - this.max.Location = new System.Drawing.Point(663, 4); + this.max.Location = new System.Drawing.Point(777, 4); this.max.Name = "max"; this.max.Size = new System.Drawing.Size(83, 21); this.max.TabIndex = 3; @@ -202,7 +205,7 @@ // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(592, 7); + this.label1.Location = new System.Drawing.Point(706, 7); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(65, 12); this.label1.TabIndex = 7; @@ -268,7 +271,7 @@ // this.label2.AutoSize = true; this.label2.BackColor = System.Drawing.SystemColors.ControlLight; - this.label2.Location = new System.Drawing.Point(592, 34); + this.label2.Location = new System.Drawing.Point(706, 34); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(65, 12); this.label2.TabIndex = 14; @@ -276,16 +279,54 @@ // // retry // - this.retry.Location = new System.Drawing.Point(663, 31); + this.retry.Location = new System.Drawing.Point(777, 31); this.retry.Name = "retry"; this.retry.Size = new System.Drawing.Size(83, 21); this.retry.TabIndex = 13; - this.retry.Text = "3"; + this.retry.Text = "5"; + // + // baiducheck + // + this.baiducheck.AutoSize = true; + this.baiducheck.Checked = true; + this.baiducheck.CheckState = System.Windows.Forms.CheckState.Checked; + this.baiducheck.Location = new System.Drawing.Point(534, 12); + this.baiducheck.Name = "baiducheck"; + this.baiducheck.Size = new System.Drawing.Size(48, 16); + this.baiducheck.TabIndex = 15; + this.baiducheck.Text = "百度"; + this.baiducheck.UseVisualStyleBackColor = true; + this.baiducheck.CheckedChanged += new System.EventHandler(this.check_CheckedChanged); + // + // bingcheck + // + this.bingcheck.AutoSize = true; + this.bingcheck.Location = new System.Drawing.Point(534, 36); + this.bingcheck.Name = "bingcheck"; + this.bingcheck.Size = new System.Drawing.Size(48, 16); + this.bingcheck.TabIndex = 16; + this.bingcheck.Text = "必应"; + this.bingcheck.UseVisualStyleBackColor = true; + this.bingcheck.CheckedChanged += new System.EventHandler(this.check_CheckedChanged); + // + // sougoucheck + // + this.sougoucheck.AutoSize = true; + this.sougoucheck.Location = new System.Drawing.Point(600, 36); + this.sougoucheck.Name = "sougoucheck"; + this.sougoucheck.Size = new System.Drawing.Size(48, 16); + this.sougoucheck.TabIndex = 17; + this.sougoucheck.Text = "搜狗"; + this.sougoucheck.UseVisualStyleBackColor = true; + this.sougoucheck.CheckedChanged += new System.EventHandler(this.check_CheckedChanged); // // Frm_Main // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.ClientSize = new System.Drawing.Size(872, 603); + this.Controls.Add(this.sougoucheck); + this.Controls.Add(this.bingcheck); + this.Controls.Add(this.baiducheck); this.Controls.Add(this.label2); this.Controls.Add(this.retry); this.Controls.Add(this.clearsearch); @@ -339,6 +380,9 @@ private System.Windows.Forms.DataGridViewTextBoxColumn sum; private System.Windows.Forms.Label label2; private System.Windows.Forms.TextBox retry; + private System.Windows.Forms.CheckBox baiducheck; + private System.Windows.Forms.CheckBox bingcheck; + private System.Windows.Forms.CheckBox sougoucheck; } } diff --git a/Frm_Main.cs b/Frm_Main.cs index efe2a58..0f87d21 100644 --- a/Frm_Main.cs +++ b/Frm_Main.cs @@ -15,6 +15,7 @@ namespace SEOKeywordSearch { public partial class Frm_Main : Form { + List searchen = new List { "百度" }; public Frm_Main() { InitializeComponent(); @@ -72,6 +73,11 @@ namespace SEOKeywordSearch private void search_Click(object sender, EventArgs e) { + if (searchen.Count == 0) + { + MessageBox.Show("请选择启用的搜索引擎!"); + return; + } search.Enabled = false; state.ForeColor = Color.Black; state.ForeColor = Color.Red; @@ -97,6 +103,8 @@ namespace SEOKeywordSearch string pageinfo = string.Empty; foreach (SearchType s in Enum.GetValues(typeof(SearchType))) { + if (!searchen.Contains(s.ToString())) + continue; if (item.Cells[s.ToString() + "s"].Value == null) item.Cells[s.ToString() + "s"].Value = 0; state.ForeColor = Color.Black; @@ -177,9 +185,12 @@ namespace SEOKeywordSearch item.Cells["sum"].Value = 0; foreach (SearchType s in Enum.GetValues(typeof(SearchType))) { - int all = int.Parse(item.Cells["sum"].Value.ToString()); - int add = int.Parse(item.Cells[s.ToString() + "s"].Value.ToString()); - item.Cells["sum"].Value = all + add; + if (searchen.Contains(s.ToString())) + { + int all = int.Parse(item.Cells["sum"].Value.ToString()); + int add = int.Parse(item.Cells[s.ToString() + "s"].Value.ToString()); + item.Cells["sum"].Value = all + add; + } } } Application.DoEvents(); @@ -255,5 +266,14 @@ namespace SEOKeywordSearch SearchView.Rows.Clear(); } #endregion + + private void check_CheckedChanged(object sender, EventArgs e) + { + CheckBox check = (CheckBox)sender; + if (check.Checked) + searchen.Add(check.Text); + else + searchen.Remove(check.Text); + } } }