----------------------
ASP.Net+Unity开发、
.Net培训、期待与您交流! ----------------------
ok,就是这样。有兴趣的就试试玩吧~
---------------------- ASP.Net+Unity开发、 .Net培训、期待与您交流! ----------------------详细请查看: www.itheima.com
本人因为爱好就自己建了个网站,因为里面也没有什么东西所以访问的人很少很少好像只有我自己访问
今天下午浏览csdn的时候发现了篇博文,里面简简单单的把代码一放。。。没有什么介绍什么的。我用了一个小时吧,整理了一下,供大家参考。。
界面就是这样了,下面放代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
using System.Text.RegularExpressions;
using System.Runtime.InteropServices;
namespace 简单访问博客
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button3_Click(object sender, EventArgs e)
{
string x = textBox1.Text;
if (x == "")
{
MessageBox.Show("亲,网址不能为空!");
return;
}
xx();
timer1.Enabled = true;
button3.Enabled = false;
button4.Enabled = true;
}
public void xx()
{
string x = textBox1.Text;
Regex reg = new Regex(@",");//网址之间用逗号隔开
string[] r = reg.Split(x);
Process ps = new Process();
ps.StartInfo.FileName = "iexplore.exe";//调用IE
for (int i = 0; i < r.Length; i++)
{
System.Diagnostics.Process.Start("" + r[i] + "");
}
}
private void timer1_Tick(object sender, EventArgs e)
{
xx();
}
private void button4_Click(object sender, EventArgs e)
{
timer1.Enabled = false;
button4.Enabled = false;
button3.Enabled = true;
}
private void button1_Click(object sender, EventArgs e)
{
if (textBox2.Text == "")
{
MessageBox.Show("设定时间不能为空");
return;
}
int x = Convert.ToInt32(textBox2.Text) * 1000;
timer1.Interval = x;
}
private void Form1_Load(object sender, EventArgs e)
{
button4.Enabled = false;
}
private void button2_Click(object sender, EventArgs e)
{
if (textBox3.Text == "")
{
MessageBox.Show("设定时间不能为空");
return;
}
timer2.Interval = Convert.ToInt32(textBox3.Text) * 60000;
}
private void timer2_Tick(object sender, EventArgs e)
{
Process[] myProcess;
myProcess = Process.GetProcessesByName("iexplore");
foreach (Process instance in myProcess)
{
instance.WaitForExit(3);
instance.CloseMainWindow();
}
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Process.Start("iexplore.exe", "http://www.gliii.com");
}
}
}
ok,就是这样。有兴趣的就试试玩吧~
---------------------- ASP.Net+Unity开发、 .Net培训、期待与您交流! ----------------------详细请查看: www.itheima.com