728x90
๋ฐ์ํ
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
this.AllowDrop = true;
this.DragEnter += new DragEventHandler(Form1_DragEnter);
this.DragDrop += new DragEventHandler(Form1_DragDrop);
}
void Form1_DragEnter(object sender, DragEventArgs e) {
if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy;
}
void Form1_DragDrop(object sender, DragEventArgs e) {
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
foreach (string file in files) Console.WriteLine(file);
}
}
์ถ์ฒ:
https://stackoverflow.com/questions/68598/how-do-i-drag-and-drop-files-into-an-application
How do I drag and drop files into an application?
I've seen this done in Borland's Turbo C++ environment, but I'm not sure how to go about it for a C# application I'm working on. Are there best practices or gotchas to look out for?
stackoverflow.com
728x90
๋ฐ์ํ
'๐จ๐ผโ๐ป๊ฐ๋ฐ > C#' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
C# - ๋ชจ๋ UI ํ๋ ์์ํฌ(MahApps.Metro) (0) | 2022.10.13 |
---|---|
C# - ๋น์ฃผ์ผ ์คํ๋์ค, ์ฝ๋๊ฐ ์ ์ฉ์ด ์๋๊ณ ์ด์ ๊ฒ์ผ๋ก ์คํ ๋๋ ๊ฒฝ์ฐ ํด๊ฒฐ ๋ฐฉ๋ฒ (0) | 2022.10.11 |
C# - DateTime D-Day ๊ตฌํ๊ธฐ(TimeSpan) (0) | 2022.10.08 |
C# - CookieContainer ์ฟ ํค ๊ฐ ๊ฐ์ ธ์ค๊ธฐ (0) | 2022.10.03 |
C# - RichTextBox ์๊น ์ง์ (1) | 2022.09.29 |