🙂 İNSANLARIN EN HAYIRLISI INSANLARA FAYDALI OLANDIR 🙂

Ramazan HABER / C# RMOS / drag and drop yazı taşıma

1-) C# RMOS - drag and drop yazı taşıma

 

using System.Windows.Forms;

 

namespace WindowsFormsApplication6

{

 

    // kaynak https://stackoverflow.com/questions/16004682/c-sharp-drag-and-drop-from-one-picture-box-into-another

 

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

 

            textBox1.AllowDrop = true;

        }

        private void pictureBox1_MouseDown(object sender, MouseEventArgs e)

        {

            var img = pictureBox1.Image;

            if (img == null) return;

            if (DoDragDrop(img, DragDropEffects.Move) == DragDropEffects.Move)

            {

                pictureBox1.Image = null;

            }

        }

 

        private void textBox1_DragEnter(object sender, DragEventArgs e)

        {

            if (e.Data.GetDataPresent(DataFormats.Bitmap))

                e.Effect = DragDropEffects.Move;

        }

 

        private void textBox1_DragDrop(object sender, DragEventArgs e)

        {

 

            //var bmp = (Bitmap)e.Data.GetData(DataFormats.Bitmap);

            //pictureBox2.Image = bmp;

 

            textBox1.Text = "Taşındı";

 

        }

    }

}

 

 2021 Ocak 18 Pazartesi
 454