在我的 winform 上,我有在每次按钮单击时动态创建的用户控件。我希望在运行时能够通过单击一次然后按下 ctrl 按钮来选择它们。我设法做到了,但只是为了一个。我怎样才能为所有人工作?我的代码:
private void TControl_Click(object sender, EventArgs e) //TControl is the name of usercontrol
{
TControl tc = new TControl();
Control ctrl = sender as Control;
if (ctrl != null)
tc = ctrl;//it doesn't work like this.