system.window.form.openfiledialog OpenFileDialog;
openFileDialog=new OpenFileDialog();
openFileDialog.Title="打开文件”;
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
string file = openFileDialog.FileName;(获取整个文件名)
string fileOpenPath, fileName;
int index = file.LastIndexOf("\\");(获取第一个开始以“\\”结尾的位置)
fileOpenPath =file.Substring(0,index);(从0截取到“\\"的长度)
fileName = file.Substring(index+1,file.Length-index-1);(从index加一到总长度)
}