반응형 전체 글576 C# 특정 폴더의 지정된 확장자들의 파일들 가져오기 C# 특정 폴더의 특정 확장자들 지정해서 파일 가져오기 특정 확장자들의 파일만 가져올 때 , 디렉터리에서 파일 가져오는 기본 메소드 : Directory.GetFiles() 필터 및 정렬 : LINQ Lambda 식 사용 메소드 선언. public static List fn_getPcFiles(String pc_fd, List filterList) { List list = new List(); var ext = filterList; foreach (string file in Directory.GetFiles(pc_fd, "*.*").Where(s => ext.Any(e => s.ToLower().EndsWith(e))).OrderByDescending(f => new FileInfo(f).LastWrit.. 2019. 1. 25. [OpenCV 설치] Windows OpenCv 설치 OpenCV 설치 Windows OpenCV OpenCV 공식 홈페이지로 갑니다. https://opencv.org 상단 메뉴의 RELEASES 를 클릭하고 원하는 버전의 Win Pack 을 클릭하여 다운로드 페이지로 이동합니다. 광고가 겁나많은 다운로드 페이지에서 3..2..1.. 기다리면 다운로드가 실행됩니다. 다운로드가 완료되면 실행파일을 클릭하여 실행합니다. ... 버튼을 눌러 설치 경로를 변경해줍니다. ( Extract 경로는 그대로 사용해도됩니다만 Downloads 폴더는 깜박하고 다 지울수도 있기 때문에ㅎㅎ; ) C: 를 선택하고 확인을 누릅니다. Extract 버튼을 누릅니다. 압축풀기가 진행됩니다. 완료되면 C:\ 아래 opencv 폴더가 생깁니다. 환경변수 등록 윈도우 시작키 -> "환.. 2019. 1. 23. C# substring 문자열 자르기 C# Substring 문자열 자르기 String.Substring 을 씁니다. string str = "abcd12345가나다라마"; Console.WriteLine("str.Substring(0, 4) = {0}", str.Substring(0, 4)); Console.WriteLine("str.Substring(4, 5) = {0}", str.Substring(4, 5)); Console.WriteLine("str.Substring(9) = {0}", str.Substring(9)); // str.Substring(-5); // -> System.ArgumentOutOfRangeException // str.Substring(100);// -> System.ArgumentOutOfRangeExcep.. 2019. 1. 22. C# File 쓰기 ( File, StreamWrite ) C# 파일 쓰기 System.IO.File System.IO.StreamWrite System.IO.File 을 이용한 파일 쓰기 using System.IO; 를 사용 합니다. 코드 string path = @"d:\tmp\test.txt"; string[] lines = { "hello", "nice to meet you", "bye~" }; File.WriteAllLines(path, lines); 결과 text.txt hello nice to meet you bye~ 코드 string allText = "welcome. http://hello-bryan.tistory.com" + "\nthis is next line"; File.WriteAllText(path, allText); 결과 text.t.. 2019. 1. 22. [007] Form modal 효과. 모서리 라운드, 배경 투명하게. Windows Form Modal 창 효과 내기Windows Form ModalVisual C# 기본적으로 Form 을 modal 창으로 띄우려면 Form.ShowDialog() 를 하면 됩니다. 여기에 웹에서 보면 모달창이 떠있는 동안 뒷 배경이 회색 반투명하게 보이죠? 대부분.모서리도 둥글게 라운드되어있고요. 그걸 Windows Form 에서 해보겠습니다. 요약1. 호출하는 Form ( 아무거나 만들어서 버튼클릭 이벤트를 하나 추가합니다. )2. 뒷배경을 반투명하게 할 form ( 재사용 )3. Custom Dialog Form ( Yes , No 버튼등을 만들어서 물어보는 창 ) 일단 Form 을 추가합니다. 이름은 FormModalBack 이라고 하겠습니다. 그리고 아래와 같이 속성을 변경해 줍니다.FormBorderS.. 2019. 1. 22. PDA 원격제어. pda remote PDA 를 원격으로 제어하고 싶을 때, 1. USB로 연결된 상태2. PC와 같은 대역의 WIFI 에 연결되어있는 상태에 가능합니다. MyMobiler 라는 프로그램을 쓰면 아래와같이 PC 화면에서 PDA 화면을 볼 수 있습니다. 일단 첨부한 MyMobiler 를 다운받습니다.새 버전이 있을 수 도있으니 구글에서 검색해봐도 됩니다.압축풀고 .exe 파일을 실행하면 설치됩니다. ( 압축 푸는건지.. ) 암튼.설치 경로를 잘 봐둡니다 일단 MyMoblier 를 클릭해서 실행 시킨 후 PC 에서 (PDA와 USB 로 연결되 있는 상태에서) 위 폴더 중 MyMoblier 폴더를 복사해서 PDA 에 복사합니다. PDA 아무 경로나 상관없습니다.복사 후 폴더 안의 remote.exe.40 을 remote.exe 로.. 2019. 1. 22. TreeView DirectoryInfo (TreeView 폴더 구조 보여주기) TreeView C#Visual StudioWindows Form TreeView 에 Directory node 를 표시하는 코드 입니다. Windows Form 을 생성하고 TreeView 를 추가합니다.1. Create FormTree.cs2. Drag & Drop "TreeView" From Tools to Form 12345678910111213141516 private void ListDirectory(TreeView treeView, string path) { treeView.Nodes.Clear(); var rootDirectoryInfo = new DirectoryInfo(path); treeView.Nodes.Add(CreateDirectoryNode(rootDirectoryInfo));.. 2019. 1. 20. C# Color 사용하기 Color C# 색 기본 설정하기. Color c = Color.Red; c = Color.DarkBlue; c = Color.Black; this.BackColor = c; Color. 하면 선택할 수 있는 list가 나옵니다. Windows Form project 에서 위 소스를 실행하면 Form 의 배경색상이 black 으로 됩니다. Color.FromArgb() 사용 c = Color.FromArgb(255, 0, 0); // R, G, B this.BackColor = c; 위 소스를 실행하면 빨간색 배경이 됩니다. FromArgb 를 이용하면 Form 배경 속성이 서서히 다른색으로 바뀌게 할 수 있습니다. Form 색상이 계속해서 바뀌는 간단한 소스 int r = 0, g = 0, b = 0;.. 2019. 1. 20. C# try catch finally 제대로 쓰기 try catch finally C# try 문 실행 순서 예제 정상적인 종료 (Exception 발생 안할 때) private string tryTest() { try { Console.WriteLine("#try"); return "return in Try"; } catch(Exception ex) { Console.WriteLine("#catch"); return ex.Message; } finally { Console.WriteLine("#finally"); } } 이 소스의 실행 순서는 1 2 3 #try #finally cs 입니다. return 하기 전에 finally 문이 실행됩니다. 만약 Exception 이 발생하면 어떻게 될까요? private string exceptionTest().. 2019. 1. 20. [006] Dictionary 사용법. 기본,응용 C# Dictionary 사용법 Dictionary 기본 사용법 // 선언 Dictionary dic = new Dictionary(); // 값 추가 dic.Add("빨강", "red"); dic.Add("파랑", "blue"); // element 수 Console.WriteLine("Dictionary 수 : {0}", dic.Count); // key 체크 if (dic.ContainsKey("빨강")) Console.WriteLine("빨강이 있음"); foreach (var key in dic.Keys) { Console.WriteLine("{0} 은 영어로 {1} 입니다.", key, dic[key]); } // 이미 있는 값 변경. dic["파랑"] = "BLUE"; // red 가 한글로.. 2019. 1. 19. 이전 1 ··· 53 54 55 56 57 58 다음 728x90 반응형