Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 通过工具箱项移动或拖动程序_C#_Drag_Noborder - Fatal编程技术网

C# 通过工具箱项移动或拖动程序

C# 通过工具箱项移动或拖动程序,c#,drag,noborder,C#,Drag,Noborder,我正在处理一个C#项目,我已经删除了表单边框,因此用户无法拖动程序。我需要他们能够拖动菜单条或其他一些工具箱项,而不是窗体边框 是我的项目的顶部:在任何位置单击表单内部拖动 private void Form1_MouseMove(object sender, MouseEventArgs e) { if ((e.Button & MouseButtons.Left) == MouseButtons.Left) {

我正在处理一个C#项目,我已经删除了表单边框,因此用户无法拖动程序。我需要他们能够拖动菜单条或其他一些工具箱项,而不是窗体边框


是我的项目的顶部:

在任何位置单击表单内部拖动

    private void Form1_MouseMove(object sender, MouseEventArgs e)
    {
        if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
        {
            Location = new Point(this.Left - (mousePoint.X - e.X), this.Top - (mousePoint.Y - e.Y));
        }
    }

    Point mousePoint = new Point(0, 0);

    private void Form1_MouseDown(object sender, MouseEventArgs e)
    {
        mousePoint = new Point(e.X, e.Y);
    }
或的可能副本