在一个表单上,我有多个usercontrols
在每次button
点击时动态创建的表单。我希望用户能够选择它们以复制删除等。就像我们用鼠标选择图标,然后删除它们。为此,我创建了另一个用户控件,它是在鼠标位置创建的。我不知道如何绘制该用户控件。到目前为止我的代码:
//method that creates usercontrols
private void _butttnAddControls_Click(object sender, EventArgs e)
{
TControl tcontrol = new TControl();
tcontrol.BringToFront();
}
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);
SelectPanel pselect = new SelectPanel();//pselect is the control used to create the rectangle for selection
pselect.Visible = true;
Point p = PointToClient(Cursor.Position);
pselect.Location = p;
pselect.SelectionPanel = true;
this.Controls.Add(pselect);
}
protected override void OnMouseUp(MouseEventArgs e)
{
base.OnMouseUp(e);
pselect.Visible = false;
}