using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace WindowsApplication1
...{
public partial class Form1 : Form
...{
public Form1()
...{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
...{
}
private void Form1_Load(object sender, EventArgs e)
...{
string path = "H:/test";
DirectoryInfo di = new DirectoryInfo(path);
foreach (FileInfo f in di.GetFiles())
...{
listBox1.Items.Add(f.Name);
}
}
private void fileSystemWatcher1_Changed(object sender, System.IO.FileSystemEventArgs e)
...{
string path = "H:/test";
DirectoryInfo di = new DirectoryInfo(path);
foreach (FileInfo f in di.GetFiles())
...{
listBox1.Items.Add(f.Name);
}
}
private void fileSystemWatcher1_Created(object sender, System.IO.FileSystemEventArgs e)
...{
string str=e.FullPath;
MessageBox.Show(str);
string path = "H:/test";
DirectoryInfo di = new DirectoryInfo(path);
listBox1.Items.Clear();
foreach (FileInfo f in di.GetFiles())
...{
listBox1.Items.Add(f.Name);
}
}
}
}
1万+

被折叠的 条评论
为什么被折叠?



