首页 > 其他分享 >获取winform的工程路径

获取winform的工程路径

时间:2023-02-28 12:33:44浏览次数:38  
标签:solutionPath string .. image 路径 jpg Bitmap 获取 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​

标签:solutionPath,string,..,image,路径,jpg,Bitmap,获取,winform
From: https://blog.51cto.com/JohnsonJu/6090739

相关文章