0
点赞
收藏
分享

微信扫一扫

获取winform的工程路径


string startupPath = System.Windows.Forms.Application.StartupPath;

string solutionPath = startupPath +@" \..\..\..\";

如果在工程目录下建立了一个Images目录,需要取其中的a.jpg,那么只需要:

Bitmap image = new Bitmap(solutionPath + @"images\a.jpg");


如果是在工程内部,还有更直接的方式,比如:这么写也是可以的:

Bitmap image = new Bitmap(@"..\..\..\images\a.jpg");


OK.

 

​​http://snippetsfor.net/Csharp​​

 

​​http://snippetsfor.net/Csharp/XamlToGraphicsPath​​

举报

相关推荐

0 条评论