zoukankan      html  css  js  c++  java
  • C# 控件拖动

    https://zhidao.baidu.com/question/2116834779399609987.html

    [DllImport("user32.dll", EntryPoint = "ReleaseCapture")]
    public static extern void ReleaseCapture();
    [DllImport("user32.dll", EntryPoint = "SendMessage")]
    public static extern void SendMessage(int hwnd, int wMsg, int wParam, int lParam);

    把上面语句加载窗体类文件中,然后在拖拽的控件上加事件,比如我是一个panel

            private void panelForm_MouseDown(object sender, MouseEventArgs e)
            {
                if (e.Button == MouseButtons.Left)
                {
                    ReleaseCapture();
                    SendMessage((int)移动的对象.Handle, 0xA1, 2, 0);
                    //是窗体自身就是
                    //SendMessage((int)this.Handle, 0xA1, 2, 0);
                    //panel就是SendMessage((int)panel1.Handle, 0xA1, 2, 0);
                }
            }

    这种才是windows标准的拖拽事件,下面那位,拖动的时候窗体会闪烁不停,一直在渲染背景

     
  • 相关阅读:
    CMD文件分析
    #ifdef __cplusplus
    nginx查看post请求日志
    JNI常见错误1
    include、include_once与require、require_once区别
    在Windows下利用Eclipse调试FFmpeg
    在Windows下利用MinGW编译FFmpeg
    图文详解YUV420, yuv格式2
    yuv rgb 像素格式1
    libyuv 编译for ios
  • 原文地址:https://www.cnblogs.com/LuoEast/p/7687869.html
Copyright © 2011-2022 走看看