1
양식에 usercontrols
이 여러 개 있습니다. button
클릭 할 때마다 동적으로 생성됩니다. 사용자가 삭제 등을 복사하기 위해 그들을 선택할 수 있기를 바랍니다. 마우스, 아이콘으로 선택한 다음 삭제하십시오. 이렇게하려면 마우스 위치에 만들어지는 또 다른 usercontrol을 만들었습니다. 그 usercontrol을 그릴 수있는 방법을 모르겠습니다. 내 코드는 지금 전까지 :다중 선택 작성 방법
//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;
}
WinForms 또는 WPF? – Guy
WinForms가 있습니다. – Viva