개발 노트

텍스트박스 드래그드랍기능 본문

프로그래밍/C#

텍스트박스 드래그드랍기능

알 수 없는 사용자 2022. 3. 21. 10:55

- 드롭될 해당 컨트롤의 AllowDrop을 true로 설정

 

 

 

		private void textBox52_DragDrop(object sender, DragEventArgs e)
		{
			string[] strFileNames = e.Data.GetData(DataFormats.FileDrop) as string[];
			foreach (string strFilePath in strFileNames)
			{
				if (e.Data.GetDataPresent(DataFormats.FileDrop))
				{
					textBox52.AppendText(System.IO.File.ReadAllText(strFilePath));
				}
			}
			//	// 파일의 내용을 텍스트박스에 추가
			//	//txtMain.AppendText( System.IO.File.ReadAllText(strFilePath));
			//	// 파일의 내용만 텍스트박스에 출력
			//	textBox52.Text += System.IO.File.ReadAllText(strFilePath);
			//	// 하나만 출력하고 그대로 빠져나감
			//	//break;
			// DragDrop은 리스트 컨트롤에 마우스를 드래그해서 놓았을때 발생하는 함수
			button16_Click(sender, e);
		}

 

참고링크

https://great-artist.tistory.com/96

https://www.csharpstudy.com/WinForms/WinForms-dragdrop.aspx

https://nantano1.tistory.com/entry/C-%EC%9C%88%ED%8F%BC%EC%97%90-%ED%8C%8C%EC%9D%BC%EC%9D%84-%EB%93%9C%EB%9E%98%EA%B7%B8-%EC%95%A4-%EB%93%9C%EB%9E%8D-Drag-Drop-File

https://mainia.tistory.com/2278

https://playground10.tistory.com/141

'프로그래밍 > C#' 카테고리의 다른 글

C# 로또 조합번호 전부 가져오기  (0) 2022.03.24
2022.03.21_발정데이터_farm3797_09시&17시  (0) 2022.03.21
C# 책 포스팅  (0) 2022.03.16
MSSQL - WITH 구문(임시테이블 만들기)  (0) 2022.03.14
SERIALIZE DESERIALIZE  (0) 2022.03.14