我有一个名为 TaskControl 和一个用于通过拖动usercontrol
创建其他按钮的按钮。usercontrols
我希望新的用户控件看起来与我的光标所在的坐标相同。下面是我的代码。它不想出现在那些坐标上,新的usercontrol
出现在旧的后面。我的代码:
private void button1_Click(object sender, EventArgs e)
{
Point localCoordinates = this.PointToClient(Cursor.Position);
TaskControl t = new TaskControl();
t.Location = new Point(Cursor.Position.X,Cursor.Position.Y);
t.MouseDown += new MouseEventHandler(t_MouseDown);
t.MouseMove += new MouseEventHandler(t_MouseMove);
t.MouseUp += new MouseEventHandler(t_MouseUp);
this.Controls.Add(t);
}