在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
http://cache.baiducontent.com/c?m=9f65cb4a8c8507ed4fece763105392230e54f73b6cd0d3027fa3cf1fd5790801013db2e5703f170fd7c27e7001d8131ab5e4732f77552fe68cc8895ddccbd77373dc7a742f0b873105a31fb8bf3532b126c34de8df0e91bfba25e2a4c5a0dc4352ba44737e9780814d7010dd1cfa033093b1e83f022e16ad9d41728b2e&p=86759a46d7c159e50be296395b5697&newp=8774c71985cc43b708e2977f0f5785231610db2151d6d3156b82c825d7331b001c3bbfb42324140ed7ce766603ad425eebf23273300421a3dda5c91d9fb4c5747990&user=baidu&fm=sc&query=C%23winform%B4%FA%B4a%D7x%C8%A1%D6%B8%B6%A8%CE%C4%BC%FE&qid=93cca5ce00011011&p1=6
本文实例讲述了winform使用相对路径读取 方法一:由于生成的exe文件
string haarXmlPath = @"../../haarcascade_frontalface_alt_tree.xml";
FileInfo file = new FileInfo(fileName); string fullName = file.FullName; 方法二:获取exe文件名,形成全路径
string haarXmlPath = @"haarcascade_frontalface_alt_tree.xml";
string fullName = Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf("\\")); fullName = fullName.Substring(0, fullName.LastIndexOf("\\")) + "\\" + haarXmlPath; 另一种方式: |
请发表评论