Programming326 C# 확장메서드 파일 잠김 여부 확인 -0- 구글에서 검색하다보니 아래 방법을 찾았습니다 -0- /// /// 해당 파일이 잠겨 있는지 여부를 확인하도록 합니다. /// /// /// public static bool thisFileLocked(this string fileFullPath) { try { using (File.Open(fileFullPath, FileMode.Open)) { } } catch(IOException er) { int errCode = Marshal.GetHRForException(er) & ((1 2016. 3. 29. C# 사용자 정의 메시지 박스 윈폼으로 만들어 보기 -0- 기존 Windows Form 프로젝트 생성후 새 항목 추가 - Windows Form을 추가하여 위 와 같이 디자인 하였다 . 하고자 하는것은 OK , Cancel 버튼을 사용자가 정의 한 문구를 표시 하며 , 위 두가지 버튼을 눌렀을 시 DialogResult 매개변수를 받는 것이었다... DialogResult 의 값을 받기 위하여 해당 추가 폼의 Designer.cs 에 해당 부분을 추가 하였습니다. // // btnOK // this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK; this.btnOK.Location = new System.Drawing.Point(12, 72); this.btnOK.Name = "btnOK"; this.bt.. 2016. 3. 29. C# Image TIFF 장수 확인 (페이지 카운트) /// /// TIF 이미지의 페이지 개수 (페이지 카운트)를 확인한다. /// /// /// public int GetTiffFrameCount(string imgFullPath) { int count = 0; using (System.Drawing.Image img = Image.FromFile(imgFullPath)) { count = img.GetFrameCount(FrameDimension.Page); } return count; } 2016. 3. 15. C# 현재 실행중인 자기 자신의 파일명 정보 얻기 예제 Reflection 클래스를 이용하여 얻는 방법을 찾았습니다. using System; using System.Collections.Generic; using System.Linq; using System.Text; // using System.Reflection; using System.IO; namespace ConsoleUnitTest { class Program { static void Main(string[] args) { //전체 경로 Console.WriteLine(Assembly.GetEntryAssembly().Location); // 파일명 만 얻어오기 Console.WriteLine(Path.GetFileName(Assembly.GetEntryAssembly().Location)); .. 2016. 3. 7. 이전 1 ··· 39 40 41 42 43 44 45 ··· 82 다음