System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "mspaint";
p.Start();
p.WaitForExit();
MessageBox.Show("");
p.StartInfo.FileName = "mspaint";
p.Start();
p.WaitForExit();
MessageBox.Show("");
解决方案 »
- C#中在使用Spilt()函数时应该包含什么using集?
- 方法的参数里有一个timer,但是需要用到这个timer的start等方法,该怎么办??
- 淘宝的商品描述抓不到,怎么解决?
- 如何从窗口B访问窗口A的某个控件?
- 关于xml文件的加载与openFileDilag一起带来的问题!!!!!!
- 一个很奇怪的问题!搞了很久了!
- 如何正常显示文章格式.
- 类似802.3帧通过TcpClient透明传输收发处理,求请一种高效的分段方法
- 请问c#中怎么取一个字符串的最左边的n个字符?急,急,急!
- 关于自定义控件中和窗体默认按钮对回车键的抢夺问题
- 如何在程序运行读取数据时文本框中的数据不断的累加
- 如何判断一组号码中是否有连续5次以上的连号,并删除
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
// Create a new FileSystemWatcher and set its properties.
FileSystemWatcher watcher = new FileSystemWatcher();
watcher.Path = "E:\\Project\\C#组件熟悉\\窗体控件\\FileSystemWatcherExample";
/* Watch for changes in LastAccess and LastWrite times, and
the renaming of files or directories. */ watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
| NotifyFilters.FileName | NotifyFilters.DirectoryName;
// Only watch text files.
watcher.Filter = "test.txt"; // Add event handlers.
watcher.Changed += new FileSystemEventHandler(OnChanged);
watcher.Created += new FileSystemEventHandler(OnChanged);
watcher.Deleted += new FileSystemEventHandler(OnChanged);
watcher.Renamed += new RenamedEventHandler(OnRenamed);
// Begin watching.
watcher.EnableRaisingEvents = true;
// Wait for the user to quit the program. }
// Define the event handlers.
private static void OnChanged(object source, FileSystemEventArgs e)
{
// Specify what is done when a file is changed, created, or deleted.
MessageBox.Show("File: " + e.FullPath + " " + e.ChangeType);
} private static void OnRenamed(object source, RenamedEventArgs e)
{
// Specify what is done when a file is renamed.
MessageBox.Show("File:" + e.OldFullPath + "renamed to" + e.FullPath);
} }
}