private void button1_Click(object sender, EventArgs e) { #region 通用验证 bool value = false; string html = Method.GetUrl("http://acaiji.com/success/ip.php"); string localip = Method.GetIP(); MatchCollection ips = Regex.Matches(html, @"<td style='color:red;'>([\s\S]*?)</td>", RegexOptions.IgnoreCase | RegexOptions.Multiline); foreach (Match ip in ips) { if (ip.Groups[1].Value.Trim() == "9.9.9.9") { value = true; break; } } if (value == true) { Thread thread = new Thread(new ThreadStart(run)); thread.Start(); Control.CheckForIllegalCrossThreadCalls = false; } else { MessageBox.Show("IP不符"); } #endregion }