// Sürükle-Birak Islemleri | www.aliakyildirim.com | Ali AKYILDIRIM
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
// Sürükle-Birak Islemleri | www.aliakyildirim.com | Ali AKYILDIRIM
namespace DragDropIslemleri
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void txtSurukle_MouseDown(object sender, MouseEventArgs e)
{
txtBirak.DoDragDrop(txtSurukle.Text, DragDropEffects.Move);
}
private void txtBirak_DragDrop(object sender, DragEventArgs e)
{
string data = e.Data.GetData(DataFormats.Text).ToString();
txtBirak.Text = data;
}
private void txtBirak_DragOver(object sender, DragEventArgs e)
{
if (e.KeyState == 1)
{
e.Effect = DragDropEffects.Move;
}
txtSurukle.Text = string.Empty;
}
private void Form1_Load(object sender, EventArgs e)
{
pictureBox2.AllowDrop = true;
}
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
//e.Button = MouseButtons.Left;
pictureBox2.DoDragDrop(pictureBox1.Image, DragDropEffects.Move);
}
private void pictureBox2_DragDrop(object sender, DragEventArgs e)
{
pictureBox2.Image = (Image)e.Data.GetData(DataFormats.Bitmap);
}
private void pictureBox2_DragOver(object sender, DragEventArgs e)
{
if (e.KeyState == 1)
{
e.Effect = DragDropEffects.Move;
}
pictureBox1.Image = null;
}
}
}
// Sürükle-Birak Islemleri | www.aliakyildirim.com | Ali AKYILDIRIM
Kaynak: Bu Örnek, Bilge Adam egitimi Sirasinda Türkay Ürkmez Tarafindan Yapilmis ve Yazilimcik.com ailesi tarafindan gelistirilmistir.