毕业设计做的是Windows程序,但是看到同学们大多都做Web开发,加之以前实习的时候也是做Web,于是乎触发了我的Web情节,那么就把程序的帮助以及关于做成Web页面吧,这样多种技术都用上了。
但是,刚开始的这种想法一直没有付诸实现,因为不知道怎么从Windows程序打开其他程序或者说文件关联,直到今天早上。
1private void button1_Click(object sender, System.EventArgs e)
2 {
3 string strFilePath = Application.StartupPath +@"\TextFile1.txt";
4 MessageBox.Show(strFilePath);
5 System.Diagnostics.Process.Start(strFilePath);
6 }
7
8 private void button2_Click(object sender, System.EventArgs e)
9 {
10 string strFilePath = Application.StartupPath +@"\HTMLPage1.htm";
11 MessageBox.Show(strFilePath);
12 System.Diagnostics.Process.Start(strFilePath);
13 }
2 {
3 string strFilePath = Application.StartupPath +@"\TextFile1.txt";
4 MessageBox.Show(strFilePath);
5 System.Diagnostics.Process.Start(strFilePath);
6 }
7
8 private void button2_Click(object sender, System.EventArgs e)
9 {
10 string strFilePath = Application.StartupPath +@"\HTMLPage1.htm";
11 MessageBox.Show(strFilePath);
12 System.Diagnostics.Process.Start(strFilePath);
13 }
另外还有两个简单的运用,简直是高效率的写程序,舒坦。如果我们的程序是关于注册表操作或者说系统优化之类的,那么可以做得更加愉快。
1System.Diagnostics.Process.Start("shutdown",@"/l");//------------注销计算机
2System.Diagnostics.Process.Start("shutdown",@"/r");//------------重起计算机
2System.Diagnostics.Process.Start("shutdown",@"/r");//------------重起计算机
Good Day!