'프로그래밍 > C#' 카테고리의 다른 글
[C#]듀얼 스크린 Capture (0) | 2019.06.11 |
---|---|
[C#]OpenCvSharp 이미지 로드 (0) | 2019.02.05 |
[C#]파일 확장자로 구분해서 image 저장 (0) | 2018.12.15 |
[C#]CommonOpenFileDialog (0) | 2018.11.27 |
[C#]특정 폴더에 있는 모든 파일을 한 폴더에 Copy/Move (0) | 2018.11.26 |
[C#]듀얼 스크린 Capture (0) | 2019.06.11 |
---|---|
[C#]OpenCvSharp 이미지 로드 (0) | 2019.02.05 |
[C#]파일 확장자로 구분해서 image 저장 (0) | 2018.12.15 |
[C#]CommonOpenFileDialog (0) | 2018.11.27 |
[C#]특정 폴더에 있는 모든 파일을 한 폴더에 Copy/Move (0) | 2018.11.26 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | public void SaveImage(Image image, string filename) { string extension = Path.GetExtension(filename); switch (extension.ToLower()) { case ".bmp": image.Save(filename, ImageFormat.Bmp); break; case ".exif": image.Save(filename, ImageFormat.Exif); break; case ".gif": image.Save(filename, ImageFormat.Gif); break; case ".jpg": case ".jpeg": image.Save(filename, ImageFormat.Jpeg); break; case ".png": image.Save(filename, ImageFormat.Png); break; case ".tif": case ".tiff": image.Save(filename, ImageFormat.Tiff); break; default: throw new NotSupportedException( "Unknown file extension " + extension); } } | cs |
[C#]OpenCvSharp 이미지 로드 (0) | 2019.02.05 |
---|---|
[C#] 둥근 버튼 (0) | 2019.01.12 |
[C#]CommonOpenFileDialog (0) | 2018.11.27 |
[C#]특정 폴더에 있는 모든 파일을 한 폴더에 Copy/Move (0) | 2018.11.26 |
[C#]소스 코드 접기, 펴기 (0) | 2018.11.09 |
기존 폴더 선택
윈도우 탐색기 방식의 CommonOpenFileDialog
여기에 Windows API Code Pack 1.1을 다운로드 받아서 (view raw 누름 다운로드 시작)
Microsoft.WindowsAPICodePack.dll
Microsoft.WindowsAPICodePack.Shell.dll을 참조 하면 사용가능
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | using Microsoft.WindowsAPICodePack.Dialogs; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApp8 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } // 기존 폴더 선택창 private void button1_Click(object sender, EventArgs e) { FolderBrowserDialog folderDlg = new FolderBrowserDialog(); folderDlg.ShowNewFolderButton = true; DialogResult result = folderDlg.ShowDialog(); if (result == DialogResult.OK) { textBox1.Text = folderDlg.SelectedPath; Environment.SpecialFolder root = folderDlg.RootFolder; } } // CommonOpenFileDialog 폴더 선택창 private void button2_Click(object sender, EventArgs e) { CommonOpenFileDialog dialog = new CommonOpenFileDialog(); dialog.InitialDirectory = textBox2.Text; dialog.IsFolderPicker = true; // true면 폴더 선택 false면 파일 선택 if (dialog.ShowDialog() == CommonFileDialogResult.Ok) { textBox2.Text = dialog.FileName; } } } } | cs |
[C#] 둥근 버튼 (0) | 2019.01.12 |
---|---|
[C#]파일 확장자로 구분해서 image 저장 (0) | 2018.12.15 |
[C#]특정 폴더에 있는 모든 파일을 한 폴더에 Copy/Move (0) | 2018.11.26 |
[C#]소스 코드 접기, 펴기 (0) | 2018.11.09 |
[C#]Visual Studio 스크롤바 소스맵으로 보기 (0) | 2018.11.09 |
왼쪽 선택 폴더에서 오른쪽 선택 폴더로 숨김파일을 제외한 모든 파일 이동/복사하는 프로그램
이름 중복시 뒤에 1,2,3...순으로 이름 붙이도록 되어있음
비동기는 어찌해야 되는거지???아시는 분 가르쳐줘요ㅜ
실행파일 : MoveFile\bin\Debug
소스파일 : MoveFile
[C#]파일 확장자로 구분해서 image 저장 (0) | 2018.12.15 |
---|---|
[C#]CommonOpenFileDialog (0) | 2018.11.27 |
[C#]소스 코드 접기, 펴기 (0) | 2018.11.09 |
[C#]Visual Studio 스크롤바 소스맵으로 보기 (0) | 2018.11.09 |
[C#] 확장 메소드 (0) | 2018.10.23 |
1. 단축키 Ctrl + M, Ctrl + L 전체 소스 접기, 펴기
2. 단축키 Ctrl + M, Ctrl + M 부분 소스 접기, 펴기
[C#]CommonOpenFileDialog (0) | 2018.11.27 |
---|---|
[C#]특정 폴더에 있는 모든 파일을 한 폴더에 Copy/Move (0) | 2018.11.26 |
[C#]Visual Studio 스크롤바 소스맵으로 보기 (0) | 2018.11.09 |
[C#] 확장 메소드 (0) | 2018.10.23 |
[C#] unsafe C#에서 포인트 사용하기 (0) | 2018.10.10 |
스크롤 바 맵으로 보이게 하기
도구 -> 옵션 -> 텍스트 편집기 -> 모든 언어 -> 스크롤 막대에서
동작에서 세로 스크롤 막대에 지도 모드 사용을 선택하면
아래 이미지 처럼 스크롤 바가 소스 맵으로 표시된다.
[C#]특정 폴더에 있는 모든 파일을 한 폴더에 Copy/Move (0) | 2018.11.26 |
---|---|
[C#]소스 코드 접기, 펴기 (0) | 2018.11.09 |
[C#] 확장 메소드 (0) | 2018.10.23 |
[C#] unsafe C#에서 포인트 사용하기 (0) | 2018.10.10 |
[C#]GIF 프레임 단위로 보기 (0) | 2018.10.01 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp2 { public static class ExpandMethod { /// <summary> /// 문자열 변환 /// </summary> /// <param name="obj">변환 하고자 하는 값</param> /// <param name="strDefault">기본값</param> /// <returns></returns> public static string ToStringEx(this object obj, string strDefault = "") { return Convert.ToString(obj).Trim() == string.Empty ? strDefault : Convert.ToString(obj).Trim(); } /// <summary> /// 형변환 obj -> int /// </summary> /// <param name="obj"></param> /// <returns></returns> public static int ToIntEx(this object obj) { int rtn = 0; if (int.TryParse(Convert.ToString(obj), out rtn)) return rtn; else return 0; } /// <summary> /// 형변환 obj -> double /// </summary> /// <param name="obj"></param> /// <returns></returns> public static double ToDoubleEx(this object obj) { double rtnDouble = 0; if (double.TryParse(Convert.ToString(obj), out rtnDouble)) return rtnDouble; else return 0; } } } | cs |
[C#]소스 코드 접기, 펴기 (0) | 2018.11.09 |
---|---|
[C#]Visual Studio 스크롤바 소스맵으로 보기 (0) | 2018.11.09 |
[C#] unsafe C#에서 포인트 사용하기 (0) | 2018.10.10 |
[C#]GIF 프레임 단위로 보기 (0) | 2018.10.01 |
[C#]파일 버전 알아내기 (0) | 2018.09.13 |
C#에서 포인터를 사용할 수 있다. unsafe라는 키워드를 이용하면 되는데
단 프로젝트에서 안전하지 않은 코드 허용(F)를 체크 해야한다.
실행
이런식으로 C#에서도 포인트를 사용할 수 있다.
다시 만나서 반가웠고 다시는 만나지 말자 포인터야....
[C#]Visual Studio 스크롤바 소스맵으로 보기 (0) | 2018.11.09 |
---|---|
[C#] 확장 메소드 (0) | 2018.10.23 |
[C#]GIF 프레임 단위로 보기 (0) | 2018.10.01 |
[C#]파일 버전 알아내기 (0) | 2018.09.13 |
[C#]cmd정보 명령 실행하고 결과 가져오기 (0) | 2018.08.09 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Drawing.Imaging; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WinApp { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { OpenFileDialog openFile = new OpenFileDialog(); openFile.Filter = @"GIF|*.gif"; openFile.Multiselect = false; openFile.ShowDialog(); if (openFile.FileName.Length > 0) { Image SelectImage = Image.FromFile(openFile.FileName); int intFrameCnt = SelectImage.GetFrameCount(FrameDimension.Time); this.listBox1.Items.Clear(); this.listBox1.Tag = SelectImage; for (int i = 0; i < intFrameCnt; i++) { this.listBox1.Items.Add(i.ToString()); } } } private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { if (this.listBox1.Tag == null) return; var SelectImage = this.listBox1.Tag as Image; int ii = SelectImage.SelectActiveFrame(FrameDimension.Time, listBox1.SelectedIndex); pictureBox1.Image = SelectImage; pictureBox1.Enabled = false; } } } | cs |
실행
[C#] 확장 메소드 (0) | 2018.10.23 |
---|---|
[C#] unsafe C#에서 포인트 사용하기 (0) | 2018.10.10 |
[C#]파일 버전 알아내기 (0) | 2018.09.13 |
[C#]cmd정보 명령 실행하고 결과 가져오기 (0) | 2018.08.09 |
[C#]Tuple 7.0부터 사용가능 (0) | 2018.07.26 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApp6 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { OpenFileDialog openFile = new OpenFileDialog(); openFile.Filter = "모든 파일|*.*"; openFile.Multiselect = false; openFile.ShowDialog(); if (openFile.FileName.Length > 0) { Assembly asm = Assembly.LoadFrom(openFile.FileName); AssemblyName name = asm.GetName(); MessageBox.Show(name.Version.ToString()); } } } } | cs |
실행
자동 파일 다운로드 프로그램에서 이걸 이용해서 파일을 다운로드 할지 말지 결정 하더군요.
생성일 같은거 이용해도 될꺼 같긴함
[C#] unsafe C#에서 포인트 사용하기 (0) | 2018.10.10 |
---|---|
[C#]GIF 프레임 단위로 보기 (0) | 2018.10.01 |
[C#]cmd정보 명령 실행하고 결과 가져오기 (0) | 2018.08.09 |
[C#]Tuple 7.0부터 사용가능 (0) | 2018.07.26 |
[C#]ImageResize (0) | 2018.07.24 |