Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 _3_A_CSHARP
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- richTextBox1.AllowDrop = true;
- richTextBox1.DragDrop += new DragEventHandler(this.richTextBox1_DragDrop);
- richTextBox1.DragEnter += new DragEventHandler(this.richTextBox1_DragEnter);
- }
- private void richTextBox1_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
- {
- if (e.Data.GetDataPresent(DataFormats.FileDrop))
- e.Effect = DragDropEffects.Link;
- else
- e.Effect = DragDropEffects.None;
- }
- private void richTextBox1_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
- {
- string[] filePath = (string[])e.Data.GetData(DataFormats.FileDrop, false);
- int i;
- for (i = 0; i < filePath.Length; i++)
- this.richTextBox1.AppendText(filePath[i]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement