본문 바로가기
반응형

Develop/C#5

C# using 문법 안녕하세요 개발자 망고 입니다. using 문법 처음 봤을때는 엄청 생소했는데 써보니 이거 좋은것 같아요. 꽤 간단해서 바로 Post 해보겠습니다.​ 1. Using 문법이란 보통 파일읽기/쓰기 클래스들은 사용하고 나면 dispose를 해줘야 하는데 using을 쓰면 따로 해제하지 않아도 됩니다. 예를 들어 using을 사용하지 않은경우 FileStream stream = new FileStream(path, FileMode.Open) StreamReader reader = new StreamReader(stream) string dataToLoad = reader.ReadToEnd(); //close를 하는게 보통임 reader.close(); stream.close(); using 사용 시 (clos.. 2022. 12. 28.
c# image crop 방법 1. image crop 을 위한 소스코드 Bitmap bitmap = new Bitmap("원본 이미지 path"); Rectangle rect = new Rectangle(30, 30, 100, 200); Bitmap cropBitmap = cropAtRect(bitmap, rect); cropBitmap.Save("새로운 위치.jpg", ImageFormat.Jpeg); public Bitmap cropAtRect(Bitmap orgImg, Rectangle sRect) { Rectangle destRect = new Rectangle(Point.Empty, sRect.Size); var cropImage = new Bitmap(destRect.Width, destRect.Height); using.. 2022. 2. 16.
c# image crop 프로그램 example 공유 - ImageCutter 1. image crop 프로그램 github https://github.com/battlemango/ImageCutter GitHub - battlemango/ImageCutter: easy image crop easy image crop. Contribute to battlemango/ImageCutter development by creating an account on GitHub. github.com 2. image crop 프로그램 사용법 - 오른쪽 listbox에 이미지가 들어있는 폴더를 drag해서 넣으면 이미지 list가 추가된다. - 마우스 클릭 또는 "A", "D" 키를 눌러 다음 이미지로 넘어갈 수 있다. - 사진을 drag 하면 한 부분이 crop되어 새로운 폴더에 저장된다. 3... 2022. 2. 16.
[C#] Drag and Drop 해서 폴더 안의 파일 리스트 보여주기 1. Drag and Drop을 이용하여 무엇을 만들것인가 listBox1에 폴더를 drag and drop 하면 폴더안의 파일 리스트를 listbox에 보여주고 label에는 drag and drop한 파일의 경로를 보여줌 2. Drag and Drop 하기 위한 listbox 속성 [도구상자]를 이용해 label과 listbox를 만들고 listbox의 속성값중 AllowDrop을 true로 변경한다 3. Drag and drop 전체 코드 listBox1_DragEnter : 파일을 drag해서 listbox안으로 들어갈때 호출되는 함수이며 마우스 effect를 바꿔 드래그 가능함을 보여주는 용도 listBox1_DragDrop : 파일을 drop 했을때 listbox에 파일 리스트를 보여주는용도 .. 2022. 2. 11.
반응형