본문 바로가기

C# /WindowsForm35

웹 페이지에서 이미지 로드하여 Drawing으로 그리기 예제 // 1. URL에서 이미지 다운로드 부분 /// /// URL 에서 이미지를 요청 하여 다운로드 합니다 /// /// private byte[] GetWebRequest(string url) { byte[] downloadData = null; try { WebRequest webRequest = WebRequest.Create(url); WebResponse webResponse = webRequest.GetResponse(); Stream stream = webResponse.GetResponseStream(); byte[] buffer = new byte[1024]; // 총 사이즈 int dataLength = (int)webResponse.ContentLength; // 메모리로 다운로드 작업.. 2015. 8. 18.
Tuple을 이용한 데이터 저장 및 전달 간단한 예제 매우 성의없고 허접하지만 그래도 만들어보았습니다 ;; class Program { static void Main(string[] args) { Test(); } public static Tuple TupleSimpleExam() { Tuple tuple = new Tuple("string", 100); return tuple; } public static void Test() { Tuple returnValue = TupleSimpleExam(); Console.WriteLine("{0} , {1} " ,returnValue.Item1, returnValue.Item2); } } 2015. 7. 9.
현재 메서드의 이름 확인 MethodBase.GetCurrentMethod().Name; -0-; 2015. 5. 14.
File.Copy 나 File.Delete시 System.UnauthorizedAccessException 발생현상 해결 방법 File.Copy 나 File.Delete시 System.UnauthorizedAccessException 발생현상 해결 방법 가끔 파일 카피나 딜리트시 위 에러가 Throw 되는 현상이 있다. 원본 파일에서 특정 파일을 복사해 지우거나 원본 파일을 지울때 그런현상이 발생하였는데 이유를 찾아보니 파일이 읽기전용으로 설정되어있었다. 원본 파일 카피시 File.SetAttributes 를 이용하여 FileAttributes 를 Normal로 설정하거나 Archive 로 설정하니 그 이후에 해당 파일을 지우는데 문제가없었다. while (fileCopy.Length != CopyFile.Length) { fileCopy.CopyTo(destinationPath + "\\" + commonInsertContex.. 2014. 5. 30.