zoukankan      html  css  js  c++  java
  • csharp中实现图片拖拽

    基于Csharp的属性、动作,添加相关委托操作,实现图相框的拖拽。
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
            private void Form1_Load(object sender, EventArgs e)
            {
                pictureBox1.AllowDrop = true;
                pictureBox2.AllowDrop = true;
                pictureBox3.AllowDrop = true;
                pictureBox1.MouseMove += SenderPB_MouseMove;
                pictureBox3.MouseMove += SenderPB_MouseMove;
            }
            private void SenderPB_MouseMove(object sender, MouseEventArgs e)
            {
                PictureBox thisPB = (PictureBox)sender;
                if ((e.Button & MouseButtons.Left) == MouseButtons.Left && (thisPB.Image != null))
                {
                    Bitmap b = new Bitmap(thisPB.Image);
                    DragDropEffects eff = ((PictureBox)sender).DoDragDrop(b, DragDropEffects.Copy);
                }
            }
            private void pictureBox2_DragEnter(object sender, DragEventArgs e)
            {
                e.Effect = DragDropEffects.Copy;
            }
            private void pictureBox2_DragDrop(object sender, DragEventArgs e)
            {
                if (e.Data.GetDataPresent(typeof(Bitmap)))
                {
                    this.pictureBox2.Image = (Bitmap)e.Data.GetData(typeof(Bitmap));
                }
            }
        }




    附件列表

      目前方向:图像处理,人工智能
    • 相关阅读:
      博客园美化-打赏代码
      苹果appID的获取方法
      简体、繁体相互转换
      iOS Socket编程(一)基本概念
      无线通信
      http与https通信
      iOS开发网络篇—发送GET和POST请求(使用NSURLSession)
      iOS开发网络篇—GET请求和POST请求的说明与比较
      iOS开发网络篇—HTTP协议
      Verify the Developer App certificate for your account is trusted on your device.
    • 原文地址:https://www.cnblogs.com/jsxyhelu/p/14682452.html
    Copyright © 2011-2022 走看看