C#
dll, exe가 있는 경로 알기
캡틴노랑이
2016. 1. 18. 13:22
반응형
아래 코드는 dll 파일이 있는 경로를 가지고 와서 해당 경로 밑의 image 폴더의 "title bar.JPG" 이미지를 불러온다.
using System.IO; using System.Reflection; string exePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string path = Path.Combine(exePath, "image"); string filePath = Path.Combine(path, "title bar.JPG"); Image img; if (File.Exists(filePath)) img = Image.FromFile(filePath);
반응형