c#按键的拖拽模板代码

    public void BtnMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {

                if (!mAllowDragKey)
                {
                    return;
                }
                Point mousePos = Control.MousePosition;
                mousePos.Offset(mouse_offset.X, mouse_offset.Y);
                KeyButton control = (KeyButton)sender;
                control.Location = control.Parent.PointToClient(mousePos);
                keepLocationShow(control);

                control.keyEntry.GetFrame().getX().setValue(control.Left);
                control.keyEntry.GetFrame().getY().setValue(control.Top);
                codeSetModeing = true;
                textBox_current_key_left.Text = control.keyEntry.GetFrame().getX().getStringValue();
                textBox_current_key_top.Text = control.keyEntry.GetFrame().getY().getStringValue();
                if (mAutoChangeMode)
                {
                    jsonObject2Text();
                }
            }
        }

你可能感兴趣的:(c#按键的拖拽模板代码)