-
C# 이미지 그리기, 출력프로그래밍 언어/C# 2020. 8. 21. 14:16
그림을 출력할때, 다음과 같은 방법이 있다.
- 절대 경로
imgTest.Source = new BitmapImage(new Uri(@"C:\Image\test.png", UriKind.Absolute));
- 상대 경로
imgTest.Source = new BitmapImage(new Uri(@"\test.png", UriKind.Relative));
- 상대 경로(리소스)
imgTest.Source = new BitmapImage(new Uri(@"\test.png", UriKind.Relative));
imgTest는 이미지 도구상자 이름이다.
BitmapImage 2번째 인자는
https://docs.microsoft.com/ko-kr/dotnet/api/system.urikind?view=netcore-3.1
- 이렇게 저장해서 필요할 때 쓰기도...
BitmapImage bitTmp = new BitmapImage(new Uri(@"\Image\1.png", UriKind.Relative));
imgTeset.Source = bitTmp;
- 리소스 방식을 쓸때는 리소스에 추가해서 써야한다.
리소스 관리 페이지로 들어가서
리소스를 추가하고
추가된 파일의 속성을 바꾸면 끝.
'프로그래밍 언어 > C#' 카테고리의 다른 글
C# RGB 출력, YUV420 -> RGB로 출력 (0) 2020.09.01 C# NAudio MicroPhone 볼륨 조절 (0) 2020.08.20