码迷,mamicode.com
首页 > Windows程序 > 详细

C#杂项

时间:2019-12-16 09:55:29      阅读:128      评论:0      收藏:0      [点我收藏+]

标签:jpg   star   ima   扩展   system   file   路径   cat   get   

取文件短名称:

shortname= Path.GetFileNameWithoutExtension(filename);      无扩展名
shortname = filename.Substring(filename.LastIndexOf(‘\\‘) + 1);  有扩展名

 

取执行文件路径:

string appPath = System.IO.Path.GetDirectoryName(Application.ExecutablePath);
string filePath = "image\Star.jpg";


组合文件路径
filePath = System.IO.Path.Combine(appPath, filePath);

C#杂项

标签:jpg   star   ima   扩展   system   file   路径   cat   get   

原文地址:https://www.cnblogs.com/wfy680/p/12047350.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!