C# 获得文件名
string strFilePaht="文件路径";Path.GetFileNameWithoutExtension(strFilePath);这个就是获取文件名的还有的就是用Substring截取strFilePaht.Substring(path.LastIndexOf("\\") + 1, path.Length - 1 - path.LastIndexOf("\\"));strFilePaht.Substring(path.LastIndexOf("."), path.Length - path.LastIndexOf("."));或者用openFileDialog1.SafeFileName
总结
- 上一篇: C#用了多线程界面还是卡死
- 下一篇: C# winform combobox